gomp-discuss
[Top][All Lists]
Advanced

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

Re: [Gomp-discuss] Decision about semaphores ..


From: Steven Bosscher
Subject: Re: [Gomp-discuss] Decision about semaphores ..
Date: 19 Feb 2003 12:31:32 +0100

Op wo 19-02-2003, om 12:24 schreef Lars Segerlund:
> 
>   I have looked at libc's semaphores, but it's explicitly stated that 
> they are not SMP safe ! ( even a bit unsure about how they would work 
> with native linux threads ).
> 
>   You use a semaphore for a join in the following fashion, every thread 
> which is started increases the value of the semaphore ( starts an 0 ), 
> when theyre finished they atomically decrease it, and the thread which 
> sets it to null uses a signal to signal the join. ( also works for 
> barriers and synchronisation ).
> 
>   Threads which have decreased the semaphore waits on the signal, and 
> the main thread can do the same.
> 
>   I was thinking of using a condition ( cond ) in the threading lib, 
> which is easy to wait on ( not busy, so sleep on would be more 
> appropriate ).
> 
> / Lars Segerlund.

Have you looked at: http://www.advancedlinuxprogramming.com/ ?

IIRC they discuss lots of threaded programming issues.  The book is
free.

Greetz
Steven







reply via email to

[Prev in Thread] Current Thread [Next in Thread]