SET_THREAD_REG(zztid, zzval, edx, EDX, post_reg_write_pthread_return)
-/* This is or'd into a pthread mutex's __m_kind field if it is used
- before Valgrind is up and running (prehistory). This is used so
- that if some early code (like the dynamic linker) takes a lock
- before Valgrind starts and then releases it afterwards, we can work
- out what's happening. */
-#define VG_PTHREAD_PREHISTORY 0x80000000
-
-
/* ---------------------------------------------------------------------
Exports of vg_signals.c
------------------------------------------------------------------ */
vg_pthread_mutex_t* vg_mutex;
CONVERT(mutex, mutex, vg_mutex);
- if (RUNNING_ON_VALGRIND) {
- VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */,
- VG_USERREQ__PTHREAD_MUTEX_LOCK,
- vg_mutex, 0, 0, 0);
- return res;
- } else {
- /* Play at locking */
- if (0)
- kludged("prehistoric lock", NULL);
- vg_mutex->__vg_m_owner = (/*_pthread_descr*/void*)1;
- vg_mutex->__vg_m_count = 1;
- vg_mutex->__vg_m_kind |= VG_PTHREAD_PREHISTORY;
- return 0; /* success */
- }
+ VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */,
+ VG_USERREQ__PTHREAD_MUTEX_LOCK,
+ vg_mutex, 0, 0, 0);
+ return res;
}
vg_pthread_mutex_t* vg_mutex;
CONVERT(mutex, mutex, vg_mutex);
- if (RUNNING_ON_VALGRIND) {
- VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */,
- VG_USERREQ__PTHREAD_MUTEX_TRYLOCK,
- vg_mutex, 0, 0, 0);
- return res;
- } else {
- /* Play at locking */
- if (0)
- kludged("prehistoric trylock", NULL);
- vg_mutex->__vg_m_owner = (/*_pthread_descr*/void*)1;
- vg_mutex->__vg_m_count = 1;
- vg_mutex->__vg_m_kind |= VG_PTHREAD_PREHISTORY;
- return 0; /* success */
- }
+ VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */,
+ VG_USERREQ__PTHREAD_MUTEX_TRYLOCK,
+ vg_mutex, 0, 0, 0);
+ return res;
}
vg_pthread_mutex_t* vg_mutex;
CONVERT(mutex, mutex, vg_mutex);
- if (RUNNING_ON_VALGRIND) {
- VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */,
- VG_USERREQ__PTHREAD_MUTEX_UNLOCK,
- vg_mutex, 0, 0, 0);
- return res;
- } else {
- /* Play at locking */
- if (0)
- kludged("prehistoric unlock", NULL);
- vg_mutex->__vg_m_owner = 0;
- vg_mutex->__vg_m_count = 0;
- vg_mutex->__vg_m_kind &= ~VG_PTHREAD_PREHISTORY;
- return 0; /* success */
- }
+ VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */,
+ VG_USERREQ__PTHREAD_MUTEX_UNLOCK,
+ vg_mutex, 0, 0, 0);
+ return res;
}
return;
}
- /* If this was locked before the dawn of time, pretend it was
- locked now so that it balances with unlocks */
- if (mutex->__vg_m_kind & VG_PTHREAD_PREHISTORY) {
- mutex->__vg_m_kind &= ~VG_PTHREAD_PREHISTORY;
- VG_TRACK( pre_mutex_lock, (ThreadId)mutex->__vg_m_owner, mutex );
- VG_TRACK( post_mutex_lock, (ThreadId)mutex->__vg_m_owner, mutex );
- }
-
/* More paranoia ... */
switch (mutex->__vg_m_kind) {
# ifndef GLIBC_2_1