If the library is not able to create a thread because resources
don't allow it at the moment, the correct thing to do is try again. Otherwise, libthr would fail this test because it doesn't allow an unlimited number of concurrent threads per application.
This commit is contained in:
parent
3b68228cce
commit
f833c84a8f
@ -65,6 +65,10 @@ main(void)
|
||||
for (i = 0; i < NITERATIONS; i++) {
|
||||
if ((error = pthread_create(&thread, NULL, thread_entry, NULL))
|
||||
!= 0) {
|
||||
if (error == EAGAIN) {
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
fprintf(stderr, "Error in pthread_create(): %s\n",
|
||||
strerror(error));
|
||||
exit(1);
|
||||
|
Loading…
Reference in New Issue
Block a user