From owner-freebsd-hackers Sat Feb 15 19:33:07 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id TAA09505 for hackers-outgoing; Sat, 15 Feb 1997 19:33:07 -0800 (PST) Received: from lightside.com (hamby1.lightside.net [207.67.176.17]) by freefall.freebsd.org (8.8.5/8.8.5) with SMTP id TAA09499 for ; Sat, 15 Feb 1997 19:33:02 -0800 (PST) Received: by lightside.com (SMI-8.6/SMI-SVR4) id TAA05777; Sat, 15 Feb 1997 19:33:15 -0800 Date: Sat, 15 Feb 1997 19:33:15 -0800 From: jehamby@lightside.com (Jake Hamby) Message-Id: <199702160333.TAA05777@lightside.com> To: jb@cimlogic.com.au Subject: Re: Threads question Cc: hackers@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-MD5: Y6LUyfnpPIR+b4kJ0+MD9Q== Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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 ). 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