Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Feb 1997 19:33:15 -0800
From:      jehamby@lightside.com (Jake Hamby)
To:        jb@cimlogic.com.au
Cc:        hackers@freebsd.org
Subject:   Re: Threads question
Message-ID:  <199702160333.TAA05777@lightside.com>

next in thread | raw e-mail | index | archive | help
John Birrell writes:

> Jake Hamby wrote:
> [...]
> > Anyway, just wanted to solicit any advice on the best thread library to use 
> > for a FreeBSD (or Linux) port of my toolkit, when it is finished.  I've 
> > decided to start with a Solaris version, simply because I have access to it 
> > (on SPARC and x86), and it has VERY good documentation on the thread 
> > functions supported, the differences between Solaris and POSIX threads, and 
> > the thread-safeness of each library function.  IMHO, this is one area where 
> > FreeBSD is very weak.  Comments?
> 
> Try FreeBSD's libc_r. It is in -current and not built by default. It has
> all the things you mention except semaphores (which can be implemented
> with a condition variable and a mutex). Even the non-POSIX suspend/resume
> functions are there! They were added to support the JDK port.
> 
> Your comment on thread-safeness for the libc functions is valid, though. 8-(
> 
> Can't comment about Linux 'cause I've never used it (and due to GPL, never
> will).

Thanks for the quick response!  I knew about libc_r already, but I've never used 
it for a project.  And I was too lazy to log into a FreeBSD box to look at the 
man pages.  But mostly, I wanted to know if there were any thread packages I 
_didn't_ already know about that might be better.  For example, "green threads", 
which Sun used for Java.  I assume those must support suspend/resume, if the JDK 
uses them?

At least on Solaris, there's a big advantage to using Solaris threads over green 
threads:  Concurrency on MP systems.  That's why Sun now has a version of the 
JDK which uses Solaris threads.  Alas, I don't have access to an MP Solaris box 
to test that tricky aspect of my program.

Anyway, I've decided that MT programming is tricky business as it is, and I'd 
rather choose the simplest, most well-documented OS to start with, then AFTER 
I'M FINISHED, consider porting to another box.  For me, Solaris is the best 
choice to work with, but I'm glad to hear that FreeBSD's libc_r is capable.  
That will definitely be the second OS I support (and then Linux maybe six months 
after that <evil grin>).

I don't want to say too much about what I'm writing at this early date, but 
let's just say that when I'm done you'll have a "cross-platform" thread library 
for C++  ... and some other stuff.

-- Jake Hamby



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702160333.TAA05777>