kamrul has asked for the wisdom of the Perl Monks concerning the following question:
As per my understanding I am not creating more than 4 threads at a time. However, after running this script for a while I get: Thread creation failed: pthread_create returned 11 What wrong am I doing?my $tcount :shared = 0; while( $message = $msgQueue->poll()){ if($tcount < 4){ Logger::log(3, "Number of active threads : ".$tcount." pro +cessing incomming message"); threads->create(processData,$message,createMsgId()); } else { Logger::log(2, "Maximum number of threads reached. Waiting +"); sleep 1 until $tcount < 4); threads->create(processData,$message,createMsgId()); } } sub processData { $tcount++; # do something $tcount--; threads->exit(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Thread creation failed: pthread_create returned 11 (races, leaks)
by tye (Sage) on Aug 11, 2015 at 05:11 UTC | |
by kamrul (Acolyte) on Aug 11, 2015 at 16:39 UTC | |
|
Re: Thread creation failed: pthread_create returned 11 (RTFM)
by tye (Sage) on Aug 11, 2015 at 00:47 UTC | |
|
Re: Thread creation failed: pthread_create returned 11
by BrowserUk (Patriarch) on Aug 11, 2015 at 00:18 UTC | |
by kamrul (Acolyte) on Aug 11, 2015 at 16:32 UTC | |
by BrowserUk (Patriarch) on Aug 11, 2015 at 18:30 UTC |