]> granicus.if.org Git - gc/commitdiff
Check pthread_atfork result (POSIX threads)
authorIvan Maidanski <ivmai@mail.ru>
Mon, 20 Feb 2012 17:58:21 +0000 (21:58 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 20 Feb 2012 17:58:21 +0000 (21:58 +0400)
* pthread_support.c (GC_thr_init): Abort on pthread_atfork failure
(only if HANDLE_FORK).

pthread_support.c

index 75b6e76cb492fbf178246efbe1c823a55557fd5b..9a9c9d34d8f0441a12181af1f237f8a5565e1df7 100644 (file)
@@ -979,8 +979,9 @@ GC_INNER void GC_thr_init(void)
   GC_ASSERT((word)&GC_threads % sizeof(word) == 0);
 # ifdef HANDLE_FORK
     /* Prepare for a possible fork.     */
-    pthread_atfork(GC_fork_prepare_proc, GC_fork_parent_proc,
-                   GC_fork_child_proc);
+    if (pthread_atfork(GC_fork_prepare_proc, GC_fork_parent_proc,
+                       GC_fork_child_proc) != 0)
+      ABORT("pthread_atfork failed");
 # endif
 # ifdef INCLUDE_LINUX_THREAD_DESCR
     /* Explicitly register the region including the address     */