The stupid question is the question not asked | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
It is not clear why you need the pcap object to be SHARED, since your code shows no locking around it anyway, and only one thread appears to be active.
My suggestion would be to create the my $capobj = Net::Pcap::open_live($dev,1024,0,0,\$err); as a not-explicitly-shared object in the main code, then start the &capture thread - either passing it the object, or letting it access the global (thread copy of the) object. You still retain active control in the main code, and, presumably, can still interrupt the capture by calling "breakloop", since you retain the (original) $capobj. "As you get older three things happen. The first is your memory goes, and I can't remember the other two... " - Sir Norman Wisdom In reply to Re: Shared variables between threads
by NetWallah
|
|