|
From: Greg P. <gp...@ap...> - 2009-07-23 20:31:40
|
On Jul 23, 2009, at 12:28 PM, Bart Van Assche wrote: > Thanks for the help. After having replaced sem_init() by sem_open() in > the pth_inconsistent_cond_wait test program, I still see the same > puzzling error message: > $ drd/tests/pth_inconsistent_cond_wait > pth_inconsistent_cond_wait.c:77 pthread_cond_timedwait(&s_cond, mutex, > &deadline) returned error code 22 (Invalid argument) The test is using a single cond with two different mutexes at the same time. POSIX says that's undefined; Darwin detects it and returns EINVAL. http://www.opengroup.org/onlinepubs/000095399/functions/pthread_cond_wait.html "When a thread waits on a condition variable, having specified a particular mutex to either the pthread_cond_timedwait() or thepthread_cond_wait() operation, a dynamic binding is formed between that mutex and condition variable that remains in effect as long as at least one thread is blocked on the condition variable. During this time, the effect of an attempt by any thread to wait on that condition variable using a different mutex is undefined." Libc/pthreads/pthread_cond.c: else if ((busy = cond->busy) != mutex) { /* Must always specify the same mutex! */ cond->waiters--; UNLOCK(cond->lock); return (EINVAL); } The comment at the top of the test suggests the test does this on purpose, and that drd is supposed to catch it first. Perhaps you're not intercepting all variants of pthread_cond_timedwait? UNIX conformance means some Libc functions have multiple versions. 0007da80 (__TEXT,__text) external _pthread_cond_timedwait 000e1787 (__TEXT,__text) external _pthread_cond_timedwait$NOCANCEL $UNIX2003 000589a8 (__TEXT,__text) external _pthread_cond_timedwait$UNIX2003 -- Greg Parker gp...@ap... Runtime Wrangler |