[fpc-devel] Threads and alot of crap

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Oct 17 11:46:37 CEST 2006


On 17 okt 2006, at 11:22, Vinzent Hoefler wrote:

>>       The pthread_cond_wait() function atomically unlocks the mutex
>> argument
>>       and waits on the cond argument.
>>
>> So the mutex should already be unlocked afterwards.
>
> If you would have read a couple of lines further you also would have
> found:
>
> |Before returning to the calling thread, pthread_cond_wait re-acquires
> |mutex (as per pthread_lock_mutex).

That is not on the Mac OS X man page for pthread_cond_wait. See
   http://www.hmug.org/man/3/pthread_cond_wait.php

>> Further, what is
>> the lock/unlock for in the intRTLEventSetEvent? pthread_cond_signal
>> can perfectly deal with multiple threads simultaneously signalling
>> the same condition variable (pthreads is a multithreading api, not a
>> random non-reentrant piece of code).
>
> Oh, is it? Read the f*cking man page:

Again, this is not on the Mac OS X man page:
     http://www.hmug.org/man/3/pthread_cond_signal.php

Not sure if this means it's not necessary in the Mac OS X (and  
possibly FreeBSD) versions, or that the Mac OS X man pages are  
incomplete.


Jonas






More information about the fpc-devel mailing list