summaryrefslogtreecommitdiff
path: root/pthread_support.c
diff options
context:
space:
mode:
authorivmai <ivmai>2011-05-16 15:12:14 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:59 +0200
commit8349c09ecc42401ec8388c4f8eefeb46a22697ef (patch)
treee84d29188c4b756b05009eb91999cf83376ca29c /pthread_support.c
parent31fc0f694f439b23c47431fc7a976691e67a3331 (diff)
2011-05-16 Ivan Maidanski <ivmai@mail.ru>
* pthread_stop_world.c (pthread_sigmask): Undefine even if not DEBUG_THREADS. * pthread_stop_world.c (GC_unblock_gc_signals): New function (only if GC_EXPLICIT_SIGNALS_UNBLOCK). * pthread_support.c (GC_unblock_gc_signals): New prototype. * pthread_support.c (GC_register_my_thread_inner, GC_register_my_thread): Call GC_unblock_gc_signals (only if GC_EXPLICIT_SIGNALS_UNBLOCK); add comment. * include/private/gcconfig.h (GC_EXPLICIT_SIGNALS_UNBLOCK): New macro.
Diffstat (limited to 'pthread_support.c')
-rw-r--r--pthread_support.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/pthread_support.c b/pthread_support.c
index 175663c..4f3be43 100644
--- a/pthread_support.c
+++ b/pthread_support.c
@@ -1358,6 +1358,10 @@ GC_INLINE void GC_record_stack_base(GC_thread me,
# endif
}
+#ifdef GC_EXPLICIT_SIGNALS_UNBLOCK
+ GC_INNER void GC_unblock_gc_signals(void); /* from pthread_stop_world.c */
+#endif
+
STATIC GC_thread GC_register_my_thread_inner(const struct GC_stack_base *sb,
pthread_t my_pthread)
{
@@ -1372,6 +1376,11 @@ STATIC GC_thread GC_register_my_thread_inner(const struct GC_stack_base *sb,
me -> stop_info.mach_thread = mach_thread_self();
# endif
GC_record_stack_base(me, sb);
+# ifdef GC_EXPLICIT_SIGNALS_UNBLOCK
+ /* Since this could be executed from a detached thread */
+ /* destructor, our signals might already be blocked. */
+ GC_unblock_gc_signals();
+# endif
return me;
}
@@ -1398,8 +1407,15 @@ GC_API int GC_CALL GC_register_my_thread(const struct GC_stack_base *sb)
if (me == 0) {
me = GC_register_my_thread_inner(sb, self);
} else {
+ /* This code is executed when a thread is registered from the */
+ /* client thread key destructor. */
GC_record_stack_base(me, sb);
me -> flags &= ~FINISHED;
+# ifdef GC_EXPLICIT_SIGNALS_UNBLOCK
+ /* Since this could be executed from a thread destructor, */
+ /* our signals might be blocked. */
+ GC_unblock_gc_signals();
+# endif
}
me -> flags |= DETACHED;
/* Treat as detached, since we do not need to worry about */