Subject: Re: pthread library
To: Larry Ruane <lruane@free-market.net>
From: B. James Phillippe spamblock <bryan-spamtrap0@darkforest.org>
List: netbsd-help
Date: 03/01/2002 00:03:00
On the crisp day of Feb 28, Larry Ruane remarked:

> Hi, does anyone have a recommendation on which POSIX thread (pthread)
> library to use on netbsd-current?  I only need binary, but don't mind
> building from source.
>
> There seem to be several thread libraries, and I'm not sure which is the
> most stable or most complete implementation of Posix threads.
>
> Thanks in advance,

Hello Larry,

I'm thrilled that you asked this question, since I just went through an
exhaustive exercise on this very subject.  In my experience, which is
using NetBSD-1.5.2/alpha (and I don't expect there to be a difference with
-current as far as threads are concerned), the PTL library is the only one
that actually works.

There is also "pth", which is simple to use and will allow your threaded
apps to compile cleanly, but it doesn't really emulate threads.  That is,
if one thread blocks (on IO for example), it seems to block the whole app.
If you want to multi-thread "Hello World", it's probably okay, but anything
sophisticated and it's all over.

Next, I tried mit-threads.  This one provides a gcc-wrapper shell script
and (IIRC) its own C library headers.  I couldn't really test it, because
it didn't seem to define "pthread_cancel()", which I thought was weird.

Last, I tried PTL.  It too has a gcc-wrapper and its own replacement
headers.  Compiling apps with it was dirty (had to disable "-Werror"), and
IIRC I could not statically link, but at least my MT app worked - for the
most part.  I still have one problem I need to track down, but otherwise
this is the only thread library which allowed my application to work.  I'm
fairly sure the problems are not in the app, because I've also built it
under Linux/x86, Linux/alpha and Solaris/sun4u and it works in those places
without problem.

I hope it works for you; please let me know via private email how it turns
out.

cheers,
-bp
--
# bryan at darkforest dot org
# Software Engineer