Pthread_create Error 11
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About how to find pthread_threads_max Us Learn more about Stack Overflow the company Business Learn more about hiring
Pthread Error Handling
developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the pthread error codes to string Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Return code from pthread_create() is 11 error return code from pthread_create is 11 error detail resource temporarily unavailable up vote 2 down vote favorite 2 I am trying to run a simple multi threaded programming and i am getting this error from gcc return code from pthread_create() is 11 how do i solve this issue ? #include
How To Find Pthread_threads_max Ubuntu
(int argc, char *argv[]) { pthread_t threads[NUM_THREADS]; int rc; long t; for(t=0; t CoolUsesForPerl PerlNews Q&A Tutorials Poetry RecentThreads NewestNodes Donate What'sNew on Aug 10, 2015 at 23:49UTC ( #1138090=perlquestion: print w/replies, xml ) Need Help?? pthread_create resource temporarily unavailable kamrul has asked for the wisdom of the Perl Monks pthread_attr_setstacksize concerning the following question: My code is like below: 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 http://stackoverflow.com/questions/7038586/return-code-from-pthread-create-is-11 threads reached. Waiting +"); sleep 1 until $tcount < 4); threads->create(processData,$message,createMsgId()); } } sub processData { $tcount++; # do something $tcount--; threads->exit(); } [download] 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 http://www.perlmonks.org/index.pl?node_id=1138090 failed: pthread_create returned 11 What wrong am I doing?Comment on Thread creation failed: pthread_create returned 11Download Code Replies are listed 'Best First'. Re: Thread creation failed: pthread_create returned 11 (races, leaks) by tye (Sage) on Aug 11, 2015 at 05:11UTC I am not creating more than 4 threads at a time. Actually, you could create unbounded many threads between the call to threads->create() and when that thread finally gets created and runs far enough to execute $tcount++. You could certainly reduce that potential problem by moving the duplicate threads->create() calls out of the if/else blocks so you have just one copy of it below that and do the $tcount++ there instead of inside of processData(). You could still potentially accumulate unbounded many threads whose execution lies somewhere between the $tcount-- and the actual ending of the thread. You also don't appear to ever join() nor detach() any of th PTHREAD_CREATE(3) NAME top pthread_create - create a new thread SYNOPSIS top #include Man Pthread_create