in reply to Re: Thread creation failed: pthread_create returned 11
in thread Thread creation failed: pthread_create returned 11
use threads; use threads::shared; my $tcount :shared = 0; while(1){ if($tcount < 4){ print("Number of active threads : ".$tcount." processing incom +ming message\n"); threads->create(processData); } else { print("Maximum number of threads reached. Waiting \n"); sleep 1 until $tcount < 4; threads->create(processData); } } sub processData { $tcount++; #sleep(2); print "OK \n"; $tcount--; threads->exit(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Thread creation failed: pthread_create returned 11 (Either join or detach)
by BrowserUk (Patriarch) on Aug 11, 2015 at 18:30 UTC |