aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime/go-go.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/runtime/go-go.c')
-rw-r--r--libgo/runtime/go-go.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libgo/runtime/go-go.c b/libgo/runtime/go-go.c
index 112d52f..7c5f40d 100644
--- a/libgo/runtime/go-go.c
+++ b/libgo/runtime/go-go.c
@@ -315,6 +315,15 @@ gc_stop_handler (int sig __attribute__ ((unused)))
return;
}
+ if (__sync_bool_compare_and_swap (&pm->holds_finlock, 1, 1))
+ {
+ /* Similarly, we can't interrupt the thread while it holds the
+ finalizer lock. Otherwise we can get into a deadlock when
+ mark calls runtime_walkfintab. */
+ __sync_bool_compare_and_swap (&pm->gcing_for_finlock, 0, 1);
+ return;
+ }
+
stop_for_gc ();
}