summaryrefslogtreecommitdiff
path: root/pthread_stop_world.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-04-19 21:18:53 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-04-19 21:18:53 +0300
commit3c69c0ed267c5a9dbec5411c4a614f167bab712c (patch)
tree96afef0a03aca1d3efd91b76facb9a2ecc9cfdc7 /pthread_stop_world.c
parent5b2c3bcd479efaaea3036e2f9002bc5eaabfeaf1 (diff)
downloadbdwgc-3c69c0ed267c5a9dbec5411c4a614f167bab712c.tar.gz
Do not reenter suspend signal if same signal used for suspend and restart
(fix of commit eddbd924a) * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL && !GC_NETBSD_THREADS_WORKAROUND] (GC_suspend_handler_inner): If GC_sig_suspend is equal to GC_sig_thr_restart then call sem_post() (on restart). * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL && !GC_NETBSD_THREADS_WORKAROUND] (GC_start_world): If GC_sig_suspend is equal to GC_sig_thr_restart then call suspend_restart_barrier() (before the world restart completed).
Diffstat (limited to 'pthread_stop_world.c')
-rw-r--r--pthread_stop_world.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/pthread_stop_world.c b/pthread_stop_world.c
index 9cc4c84f..d8aee014 100644
--- a/pthread_stop_world.c
+++ b/pthread_stop_world.c
@@ -428,8 +428,9 @@ STATIC void GC_suspend_handler_inner(ptr_t dummy GC_ATTR_UNUSED,
me -> backing_store_ptr = NULL;
me -> backing_store_end = NULL;
# endif
+
# ifndef GC_NETBSD_THREADS_WORKAROUND
- if (GC_retry_signals)
+ if (GC_retry_signals || GC_sig_suspend == GC_sig_thr_restart)
# endif
{
/* If the RESTART signal loss is possible (though it should be */
@@ -437,14 +438,10 @@ STATIC void GC_suspend_handler_inner(ptr_t dummy GC_ATTR_UNUSED,
/* much between the first sem_post and sigsuspend calls), more */
/* handshaking is provided to work around it. */
sem_post(&GC_suspend_ack_sem);
-# ifdef GC_NETBSD_THREADS_WORKAROUND
- if (GC_retry_signals)
-# endif
- {
- /* Set the flag that the thread has been restarted. */
+ /* Set the flag that the thread has been restarted. */
+ if (GC_retry_signals)
ao_store_release_async(&me->stop_info.last_stop_count,
my_stop_count | THREAD_RESTARTED);
- }
}
RESTORE_CANCEL(cancel_state);
}
@@ -1317,12 +1314,14 @@ GC_INNER void GC_start_world(void)
# else
if (GC_retry_signals) {
resend_lost_signals_retry(n_live_threads, GC_restart_all);
- } /* else */
-# ifdef GC_NETBSD_THREADS_WORKAROUND
- else {
+ } else {
+# ifndef GC_NETBSD_THREADS_WORKAROUND
+ if (GC_sig_suspend == GC_sig_thr_restart)
+# endif
+ {
suspend_restart_barrier(n_live_threads);
}
-# endif
+ }
# endif
# ifdef DEBUG_THREADS
GC_log_printf("World started\n");