This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: pthread_cond_timedwait vs pthread_mutex_timedlock


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]