Continue trying to extract myself from the pthread_mutex_* swamp.
Fall back to a compromise position, which makes my mutex implementation
initialiser- and structure-compatible with LinuxThreads, and ditto the
upcoming condition var implementation. In particular this means that
((ThreadId)0) is an invalid thread ID, so vg_threads[0] is never used,
and vg_threads[1] specially denotes the "main" thread.
Remove the scheme of having a linked list of threads waiting on
each mutex. It is too difficult to get the right semantics for
when a signal is delivered to a thread blocked in pthread_mutex_lock().
Instead, use the old scheme of each thread stating with its .waited_on_mx
field, which mutex it is waiting for. This makes pthread_mutex_unlock()
less efficient, but at least it all works.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@100 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/vg_main.c b/vg_main.c
index 7c7f612..97f17d3 100644
--- a/vg_main.c
+++ b/vg_main.c
@@ -1032,7 +1032,7 @@
}
VG_(running_on_simd_CPU) = False;
- VG_(do_sanity_checks)( 0 /* root thread */,
+ VG_(do_sanity_checks)( 1 /* root thread */,
True /*include expensive checks*/ );
if (VG_(clo_verbosity) > 1)
@@ -1068,7 +1068,7 @@
}
/* Prepare to restore state to the real CPU. */
- VG_(load_thread_state)(0);
+ VG_(load_thread_state)(1 /* root thread */);
VG_(copy_baseBlock_to_m_state_static)();
/* This pushes a return address on the simulator's stack, which