pthread_cond_timedwait vs pthread_mutex_timedlock

trifonov@rogers.blackberry.net trifonov@rogers.blackberry.net
Mon May 4 23:46:00 GMT 2009


I don't care about exclusion, so what's the most efficient way to wake this then, given I don't need a mutex? The condition functions seem to require the mutex.

------Original Message------
From: Mike Frysinger
Sender: libc-help-owner@sourceware.org
To: libc-help@sourceware.org
Cc: Borislav Trifonov
Subject: Re: pthread_cond_timedwait vs pthread_mutex_timedlock
Sent: May 4, 2009 16:43

On Monday 04 May 2009 15:26:06 Borislav Trifonov wrote:
> But if the thread can just be woken when a condition occurs, then why is a
> mutex even needed?

waking at the right time does not guarantee exclusion, it just most often
works out that way.  mutexes however absolutely guarantee exclusion.
-mike



More information about the Libc-help mailing list