Re: Perl threads



On 30 , 21:08, xhos...@xxxxxxxxx wrote:
Instead of putting in a comment telling us you are using syslog, you
should show us the code that actually "use"s syslog. (By which
you presumably mean Sys::Syslog?) Is Sys::Syslog thread safe?

use Sys::Syslog qw( :DEFAULT setlogsock); #thats how im using syslog

The easy way is not to detach the threads. Then, just before the parent
exits, run through threads->list and join all of them. Or you could use
Thread::Running

I working on network sniffer and packet analizer. The main program
starts to capture network packets with "use Net::Pcap". Each 100
packets captured - main program dumps packets in a file and starts a
new thread with arguments, contains a file name. Than main thread
continue sniffing, and the thread starts to analize the file. The idea
is to make main program work with no pauses for waiting joined thread
or something else, it causes packet missing. I tried to fire up
threads with detach (threads creates fast, 10-20 per second). But when
the main program is done (by ctrl+c or else) - perl warns me the
number of threads still running. How can i get this number by myself
to wait for detached threads dies?

.