Eli Zaretskii <[email protected]> writes:

>> From: "Diogo F. S. Ramos" <[email protected]>
>> Date: Sat, 05 Apr 2014 03:28:25 -0300
>> 
>> The following program is aborted:
>> 
>> --8<---------------cut here---------------start------------->8---
>> (define number-of-thread 1000)
>> 
>> (do ((i number-of-thread (- i 1)))
>>     ((zero? i))
>>   (call-with-new-thread (lambda () (sleep 42))))
>> --8<---------------cut here---------------end--------------->8---
>
> On what OS?

I can reproduce on OpenBSD 5.3 with Guile 2.0.11.

I wasn't sure if OpenBSD perhaps limits the number of pthreads allowed
to a process, so I used the following C program to test this, which had
all 1000 threads succeed:

/* start C code */

#include <pthread.h>
#include <stdio.h>
#include <stddef.h>

static void *thread_entry(void *arg)
{
  printf("thread %d succeeded\n", (ptrdiff_t)arg);
  return NULL;
}

int main()
{
  ptrdiff_t i;
  for (i = 0; i < 1000; ++i)
    {
      pthread_t thr;
      pthread_create(&thr, NULL, thread_entry, (void *)i);
    }
  sleep(5);
  puts("main finished");
  return 0;
}

/* end C code */

Taylan

Reply via email to