[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pthread semaphores



On Mon, 25 Feb 2002, Frank Booth wrote:

> Hi,
> 
> I've got an application that runs on FreeBSD, Linux, and other Unix variants.
> I'd like it to run on OpenBSD as well.  It uses pthreads, and pthread unnamed
> semaphores (sem_init(), sem_destroy(), sem_wait(), sem_post()) to synchronize
> the threads.  Unfortunately (for me, at least), OpenBSD doesn't have this
> family of functions.
> 
> I tried substituting pthread_mutex_*(), but the application needs to be able to
> lock a mutex in one thread, and unlock the mutex in a different thread.  This 
> is disallowed by the pthread_mutex family of functions.
> 
> semget/semop are also unsuitable, since these semaphores are OS global and each
> instance of the application requires several semaphores.
> 
> Any help (including redesign suggestions :) is appreciated.
> 
> -Frank Booth

Checkout a recent snapshot, at some point in January this was added.
http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc_r/uthread/

YMMV
I've haven't tried to build anything requiring semaphores since these
additions.


Visit your host, monkey.org