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
_______________________________________________
Gomp-discuss mailing list
address@hidden
http://mail.nongnu.org/mailman/listinfo/gomp-discuss