]> 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>
Tue, 3 Apr 2012 03:59:59 +0000 (07:59 +0400)
* pthread_support.c (GC_thr_init): Abort on pthread_atfork failure
(only if HANDLE_FORK).

pthread_support.c

index 35c17712358ca7733ea46c7d80220bf26f6acfd3..26ef6e2d147c2f3ca945594adbf4dfbd08e59922 100644 (file)
@@ -958,8 +958,9 @@ GC_INNER void GC_thr_init(void)
 
 # 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     */