}
if (ret == 0 && mutex_is_valid) {
- DO_CREQ_v_WW(_VG_USERREQ__HG_PTHREAD_COND_WAIT_POST,
- pthread_cond_t*,cond, pthread_mutex_t*,mutex);
+ DO_CREQ_v_WWW(_VG_USERREQ__HG_PTHREAD_COND_WAIT_POST,
+ pthread_cond_t*,cond, pthread_mutex_t*,mutex, long,0);
}
if (ret != 0) {
pthread_mutex_t*,mutex);
}
- if (ret == 0 && mutex_is_valid) {
- DO_CREQ_v_WW(_VG_USERREQ__HG_PTHREAD_COND_WAIT_POST,
- pthread_cond_t*,cond, pthread_mutex_t*,mutex);
+ if ((ret == 0 || ret == ETIMEDOUT) && mutex_is_valid) {
+ DO_CREQ_v_WWW(_VG_USERREQ__HG_PTHREAD_COND_WAIT_POST,
+ pthread_cond_t*,cond, pthread_mutex_t*,mutex,
+ long,ret == ETIMEDOUT);
}
if (ret != 0 && ret != ETIMEDOUT) {
}
static void evh__HG_PTHREAD_COND_WAIT_POST ( ThreadId tid,
- void* cond, void* mutex )
+ void* cond, void* mutex,
+ Bool timeout)
{
/* A pthread_cond_wait(cond, mutex) completed successfully. Find
the SO for this cond, and 'recv' from it so as to acquire a
if (SHOW_EVENTS >= 1)
VG_(printf)("evh__HG_PTHREAD_COND_WAIT_POST"
- "(ctid=%d, cond=%p, mutex=%p)\n",
- (Int)tid, (void*)cond, (void*)mutex );
+ "(ctid=%d, cond=%p, mutex=%p)\n, timeout=%d",
+ (Int)tid, (void*)cond, (void*)mutex, (Int)timeout );
thr = map_threads_maybe_lookup( tid );
tl_assert(thr); /* cannot fail - Thread* must already exist */
tl_assert(cvi->so);
tl_assert(cvi->nWaiters > 0);
- if (!libhb_so_everSent(cvi->so)) {
+ if (!timeout && !libhb_so_everSent(cvi->so)) {
/* Hmm. How can a wait on 'cond' succeed if nobody signalled
it? If this happened it would surely be a bug in the threads
library. Or one of those fabled "spurious wakeups". */
mutex=arg[2] */
case _VG_USERREQ__HG_PTHREAD_COND_WAIT_POST:
evh__HG_PTHREAD_COND_WAIT_POST( tid,
- (void*)args[1], (void*)args[2] );
+ (void*)args[1], (void*)args[2],
+ (Bool)args[3] );
break;
case _VG_USERREQ__HG_PTHREAD_RWLOCK_INIT_POST: