in reply to Re: threads and SNMP Session
in thread threads and SNMP Session

Perl version is 5.8.5 Platform: Gentoo linux Yes, it does work if i dont use threads. It also works if I add  sleep 1; to the subroutine test before printing the info. Hope this helps!

Replies are listed 'Best First'.
Re^3: threads and SNMP Session
by renodino (Curate) on Dec 20, 2005 at 01:02 UTC
    I didn't see a join() anywhere in your app (which may explain your ability to get a result w/ sleep 1). After you spawn your threads, you need to explicitly wait for them all to complete via:
    $thr->join(); $thr2->join(); ...etc...
    Otherwise the main thread will just exit, which may cause the child threads to get prematurely killed.