leonidlm has asked for the wisdom of the Perl Monks concerning the following question:
Unfortunately my code crashes the interpreter (in the $thread->join() call) with the error: "Free to wrong pool 1825cf0 not ff during global destruction".my @threads; my $thread; my $rc; while (@threads = threads->list()) { foreach $thread (@threads) { if ($thread->is_joinable()) { $rc = $thread->join(); # Send the opcmon # $rc->[0] is the return code. # $rc->[1] is the nodeName the thread worked on. &sendOpcmon($tag, $rc->[0], $rc->[1]); } } # To prevent the hard CPU lookups sleep(1); } # sub sendRequest { require IO::Socket::INET; #IO::Socket::INET->import(...); my ($msg, $peerAddr, $peerPort) = @_; my $eTime = time() + TIMEOUT; my $host = (split/\./, $msg)[0]; # configure the socket. $MySocket = new IO::Socket::INET->new( PeerPort => $peerPort, Proto => 'udp', PeerAddr => $peerAddr, ); ioctl($MySocket, 0x8004667e, pack("I", 1)); # Send the request. $MySocket->send($msg); # Now we will wait till the server will respond to our request. while(time() < $eTime) { $MySocket->recv($text,128); if($text =~ /OK/) { return [1, $host]; } # Sleep for 2 secs just to free up a %CPU usage sleep 2; } # We reached the timeout, probably no response will arrive. return [0, $host]; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: win32 threads problem
by zentara (Cardinal) on Dec 07, 2008 at 14:41 UTC | |
by leonidlm (Pilgrim) on Dec 07, 2008 at 15:04 UTC | |
|
Re: win32 threads problem
by BrowserUk (Patriarch) on Dec 07, 2008 at 16:27 UTC | |
by leonidlm (Pilgrim) on Dec 07, 2008 at 16:36 UTC | |
by BrowserUk (Patriarch) on Dec 07, 2008 at 22:43 UTC | |
by leonidlm (Pilgrim) on Dec 08, 2008 at 07:42 UTC | |
by BrowserUk (Patriarch) on Dec 08, 2008 at 08:10 UTC | |
by zentara (Cardinal) on Dec 07, 2008 at 17:51 UTC |