guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does Guile have a thread limit?


From: Taylan Ulrich Bayırlı /Kammer
Subject: Re: Does Guile have a thread limit?
Date: Sat, 05 Apr 2014 14:27:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix)

Eli Zaretskii <address@hidden> writes:

>> From: "Diogo F. S. Ramos" <address@hidden>
>> 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

[Prev in Thread] Current Thread [Next in Thread]