Pthreads and thread caching(Was: Re: [kaffe] unix-pthreads broken on sunos)

Dalibor Topic robilad@kaffe.org
Mon May 31 13:58:05 2004


Dalibor Topic wrote:

> On the other hand, I'm wondering why we have to check for the pthread 
> max anyway, since my understanding of pthread_create [4] is that it will 
> return EAGAIN on failure, so we could simply use that on all systems, no?
> 
> I'll write a patch that does that, and give it a spin on linux.

Done, passes all the regression tests except ThreadStop, which is an 
expected failure with pthreads, so I'll check it in. Please give the CVS 
head later a spin on the less mainstream platforms. Since a lot of nice 
things require pthreads (classpath awt, gjdoc, ...) it would be nice if 
we could make kaffe's pthreads the default threading system in the long 
run, and make sure that it works.

Since I didn't know what a good value for MAX_CACHED_THREADS should be 
(as it depended on PTHREAD_THREADS_MAX, and that one is not constant on 
some systems), I turned thread caching off. I hope that it will make 
debugging the change I made easier, in case it breaks something on 
someone's setup. Proposals are welcome, maybe we could use some factor 
instead (like two thirds of the created threads will be cached, or 
something like that). And maybe we could use a system property for that, 
to make it easier to tune the caching behaviour to specific applications 
if necessary.

cheers,
dalibor topic