thread_leave_synchr(drd_tid);
break;
- case VG_USERREQ__SPIN_INIT_OR_UNLOCK:
- tl_assert(thread_get_synchr_nesting_count(drd_tid) == 0);
- drd_spin_init_or_unlock(arg[1]);
+ case VG_USERREQ__PRE_SPIN_INIT_OR_UNLOCK:
+ if (thread_enter_synchr(drd_tid) == 0)
+ drd_spin_init_or_unlock(arg[1]);
+ break;
+
+ case VG_USERREQ__POST_SPIN_INIT_OR_UNLOCK:
+ thread_leave_synchr(drd_tid);
break;
case VG_USERREQ__PRE_COND_INIT:
/* to notify the drd tool of pthread_mutex_unlock calls */
VG_USERREQ__POST_MUTEX_UNLOCK,
/* args: Addr */
- VG_USERREQ__SPIN_INIT_OR_UNLOCK,
- /* args: Addr spinlock */
+ /* to notify the drd tool of a pthread_spin_init/pthread_spin_unlock call */
+ VG_USERREQ__PRE_SPIN_INIT_OR_UNLOCK,
+ /* args: Addr */
+ /* to notify the drd tool of a pthread_spin_init/pthread_spin_unlock call */
+ VG_USERREQ__POST_SPIN_INIT_OR_UNLOCK,
+ /* args: Addr */
/* to notify the drd tool of a pthread_cond_init call. */
int res;
OrigFn fn;
VALGRIND_GET_ORIG_FN(fn);
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__SPIN_INIT_OR_UNLOCK,
- spinlock, mutex_type_spinlock, 0, 0, 0);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_SPIN_INIT_OR_UNLOCK,
+ spinlock, 0, 0, 0, 0);
CALL_FN_W_WW(ret, fn, spinlock, pshared);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_SPIN_INIT_OR_UNLOCK,
+ spinlock, 0, 0, 0, 0);
return ret;
}
int res;
OrigFn fn;
VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_MUTEX_DESTROY,
+ spinlock, 0, 0, 0, 0);
CALL_FN_W_W(ret, fn, spinlock);
VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_MUTEX_DESTROY,
spinlock, mutex_type_spinlock, 0, 0, 0);
int res;
OrigFn fn;
VALGRIND_GET_ORIG_FN(fn);
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__SPIN_INIT_OR_UNLOCK,
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_SPIN_INIT_OR_UNLOCK,
spinlock, mutex_type_spinlock, 0, 0, 0);
CALL_FN_W_W(ret, fn, spinlock);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_SPIN_INIT_OR_UNLOCK,
+ spinlock, 0, 0, 0, 0);
return ret;
}