semantics of pthread locks
From: Scott J. McCaughrin (sjmccaug_at_bluestem.prairienet.org)
Date: Thu, 29 Sep 2005 21:25:35 +0000 (UTC)
I can accept the need to call pthread_mutex_lock() before dealing with a
condition variable, but why must a shared resource be tested prior to
calling pthread_cond_wait()? Suppose a wait-thread is expected to block
until a shared counter reaches a certain value: why must it test for the
condition first, before the call (assuming the condition is not met)?