mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-11 05:55:48 +00:00
Partially merge patch from Jeremy Fitzhardinge:
13-track-condvar-mutex This fixes mutex lock/unlock tracking. In particular, it gets tracking of mutex ownership over condition variables correct. I didn't take the bits to do with vg_tid_currently_in_baseBlock's value when baseBlock is empty. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1252
This commit is contained in:
@@ -2318,6 +2318,8 @@ void release_one_thread_waiting_on_mutex ( pthread_mutex_t* mutex,
|
||||
break;
|
||||
}
|
||||
|
||||
VG_TRACK( post_mutex_unlock, (ThreadId)mutex->__m_owner, mutex );
|
||||
|
||||
vg_assert(i <= VG_N_THREADS);
|
||||
if (i == VG_N_THREADS) {
|
||||
/* Nobody else is waiting on it. */
|
||||
@@ -2333,6 +2335,8 @@ void release_one_thread_waiting_on_mutex ( pthread_mutex_t* mutex,
|
||||
VG_(threads)[i].associated_mx = NULL;
|
||||
/* m_edx already holds pth_mx_lock() success (0) */
|
||||
|
||||
VG_TRACK( post_mutex_lock, (ThreadId)i, mutex);
|
||||
|
||||
if (VG_(clo_trace_pthread_level) >= 1) {
|
||||
VG_(sprintf)(msg_buf, "%s mx %p: RESUME",
|
||||
caller, mutex );
|
||||
@@ -2520,8 +2524,6 @@ void do_pthread_mutex_unlock ( ThreadId tid,
|
||||
vg_assert(mutex->__m_count == 1);
|
||||
vg_assert((ThreadId)mutex->__m_owner == tid);
|
||||
|
||||
VG_TRACK( post_mutex_unlock, tid, mutex);
|
||||
|
||||
/* Release at max one thread waiting on this mutex. */
|
||||
release_one_thread_waiting_on_mutex ( mutex, "pthread_mutex_lock" );
|
||||
|
||||
@@ -2584,6 +2586,8 @@ void do_pthread_cond_timedwait_TIMEOUT ( ThreadId tid )
|
||||
mx->__m_owner = (_pthread_descr)tid;
|
||||
mx->__m_count = 1;
|
||||
|
||||
VG_TRACK( post_mutex_lock, tid, mx );
|
||||
|
||||
if (VG_(clo_trace_pthread_level) >= 1) {
|
||||
VG_(sprintf)(msg_buf,
|
||||
"pthread_cond_timedwai cv %p: TIMEOUT with mx %p",
|
||||
@@ -2649,6 +2653,8 @@ void release_N_threads_waiting_on_cond ( pthread_cond_t* cond,
|
||||
mx->__m_count = 1;
|
||||
/* .m_edx already holds pth_cond_wait success value (0) */
|
||||
|
||||
VG_TRACK( post_mutex_lock, i, mx );
|
||||
|
||||
if (VG_(clo_trace_pthread_level) >= 1) {
|
||||
VG_(sprintf)(msg_buf, "%s cv %p: RESUME with mx %p",
|
||||
caller, cond, mx );
|
||||
|
||||
Reference in New Issue
Block a user