Subject: Re: Pth implementation
To: None <port-mac68k@netbsd.org>
From: Magnus Henoch <mange@freemail.hu>
List: port-mac68k
Date: 06/15/2005 23:03:02
Conrad Rehill <conrad@rehill.org> writes:

> Hi Everyone.
>
> Does anyone have any experience with using Pth to build an application 
> originally written using pthreads ?
>
> Specifically, I have an application which compiles and works well when 
> built against libpthread on a linux system.  The code compiles with no 
> problem using the Pth pthreads compatibility flags on my 68040 Mac, but at 
> runtime I get an error:
>
> **Pth** scheduler internal error: no more threads available to schedule
>
> It seems to choke at a 'pthread_create()' call in my code.

Here comes a wild guess.  The pthread emulation of Pth is
non-preemptive, unlike most other pthread implementations, which means
that the code must explicitly yield control to other threads.  Thus,
it's possible that many threads have been created, but haven't had
much of a chance to run, as other threads are running.  This would
lead to threads being created faster than they can finish their task.

So try to sprinkle pth_yield calls around the code, and see if that
helps.

Magnus