}
/* Set the flag making the change visible to the signal handler. */
- /* This also removes the protection for t object, preventing */
- /* write faults in GC_store_stack_ptr (thus double-locking should */
- /* not occur in async_set_pht_entry_from_index). */
AO_store_release(&t->suspended_ext, TRUE);
if (THREAD_EQUAL((pthread_t)thread, pthread_self())) {
GC_wait_for_reclaim();
# endif
+ if (GC_manual_vdb) {
+ /* See the relevant comment in GC_stop_world. */
+ GC_acquire_dirty_lock();
+ }
+ /* Else do not acquire the lock as the write fault handler might */
+ /* be trying to acquire this lock too, and the suspend handler */
+ /* execution is deferred until the write fault handler completes. */
+
/* TODO: Support GC_retry_signals (not needed for TSan) */
- GC_acquire_dirty_lock();
switch (RAISE_SIGNAL(t, GC_sig_suspend)) {
/* ESRCH cannot happen as terminated threads are handled above. */
case 0:
if (errno != EINTR)
ABORT("sem_wait for handler failed (suspend_self)");
}
- GC_release_dirty_lock();
+ if (GC_manual_vdb)
+ GC_release_dirty_lock();
RESTORE_CANCEL(cancel_state);
UNLOCK();
}
GC_nacl_thread_parker = pthread_self();
GC_nacl_park_threads_now = 1;
+ if (GC_manual_vdb)
+ GC_acquire_dirty_lock();
while (1) {
int num_threads_parked = 0;
struct timespec ts;
num_sleeps = 0;
}
}
+ if (GC_manual_vdb)
+ GC_release_dirty_lock();
# endif /* NACL */
return n_live_threads;
}
if (GC_parallel)
GC_acquire_mark_lock();
# endif
+ GC_acquire_dirty_lock();
}
/* Called in parent after a fork() (even if the latter failed). */
#endif
static void fork_parent_proc(void)
{
+ GC_release_dirty_lock();
# if defined(PARALLEL_MARK)
if (GC_parallel)
GC_release_mark_lock();
#endif
static void fork_child_proc(void)
{
- /* Clean up the thread table, so that just our thread is left. */
+ GC_release_dirty_lock();
# if defined(PARALLEL_MARK)
if (GC_parallel)
GC_release_mark_lock();
# endif
+ /* Clean up the thread table, so that just our thread is left. */
GC_remove_all_threads_but_me();
# ifdef PARALLEL_MARK
/* Turn off parallel marking in the child, since we are probably */