in reply to Shared variables between threads
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Shared variables between threads
by Saladino (Beadle) on Nov 02, 2007 at 16:25 UTC |