[fpc-devel] Threads and alot of crap

Micha Nelissen micha at neli.hopto.org
Tue Oct 17 11:19:56 CEST 2006


Jonas Maebe wrote:
> This last pthread_mutex_unlock does not make sense to me. From the 
> pthread_cond_wait man page:

Read the man page *completely*.

	A  condition  variable  must  always be associated with a mutex, to 
avoid the race condition where a thread prepares to wait on a condition 
variable and another thread signals the  condition just before the first 
thread actually waits on it.

and:

	Before returning to the calling thread, !pthread_cond_wait! re-acquires 
|mutex| (as per !pthread_lock_mutex!).

Micha



More information about the fpc-devel mailing list