[前][次][番号順一覧][スレッド一覧]

ruby-changes:17947

From: ko1 <ko1@a...>
Date: Sun, 28 Nov 2010 22:00:55 +0900 (JST)
Subject: [ruby-changes:17947] Ruby:r29963 (trunk): * thread_pthread.c: remove pthread_atfork().

ko1	2010-11-28 22:00:49 +0900 (Sun, 28 Nov 2010)

  New Revision: 29963

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29963

  Log:
    * thread_pthread.c: remove pthread_atfork().

  Modified files:
    trunk/ChangeLog
    trunk/thread_pthread.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29962)
+++ ChangeLog	(revision 29963)
@@ -1,3 +1,7 @@
+Mon Nov 29 05:58:58 2010  Koichi Sasada  <ko1@a...>
+
+	* thread_pthread.c: remove pthread_atfork().
+
 Mon Nov 29 05:54:22 2010  Koichi Sasada  <ko1@a...>
 
 	* thread_pthread.c (native_cond_*): Check return code.
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 29962)
+++ thread_pthread.c	(revision 29963)
@@ -29,8 +29,6 @@
 static void native_cond_initialize(pthread_cond_t *cond);
 static void native_cond_destroy(pthread_cond_t *cond);
 
-static void native_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void));
-
 #define native_mutex_reinitialize_atfork(lock) (\
 	native_mutex_unlock(lock), \
 	native_mutex_initialize(lock), \
@@ -125,39 +123,19 @@
 }
 
 static void
-gvl_atfork(rb_vm_t *vm)
-{
-#if GVL_SIMPLE_LOCK
-    native_mutex_reinitialize_atfork(&vm->gvl.lock);
-#else
-    /* do nothing */
-#endif
-}
-
-static void gvl_reinit(rb_vm_t *vm);
-
-static void
-gvl_atfork_child(void)
-{
-    gvl_reinit(GET_VM());
-}
-
-static void
 gvl_init(rb_vm_t *vm)
 {
     if (GVL_DEBUG) fprintf(stderr, "gvl init\n");
-    native_atfork(0, 0, gvl_atfork_child);
-    gvl_reinit(vm);
-}
 
-static void
-gvl_reinit(rb_vm_t *vm)
-{
+#if GVL_SIMPLE_LOCK
+    native_mutex_reinitialize_atfork(&vm->gvl.lock);
+#else
     native_mutex_initialize(&vm->gvl.lock);
     vm->gvl.waiting_threads = 0;
     vm->gvl.waiting_last_thread = 0;
     vm->gvl.waiting = 0;
     vm->gvl.acquired = 0;
+#endif
 }
 
 static void
@@ -168,6 +146,14 @@
 }
 
 static void
+gvl_atfork(rb_vm_t *vm)
+{
+    if (GVL_DEBUG) fprintf(stderr, "gvl atfork\n");
+    gvl_init(vm);
+    gvl_acquire(vm, GET_THREAD());
+}
+
+static void
 mutex_debug(const char *msg, pthread_mutex_t *lock)
 {
     if (0) {
@@ -293,15 +279,6 @@
     return r;
 }
 
-static void
-native_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void))
-{
-    int r = pthread_atfork(prepare, parent, child);
-    if (r != 0) {
-	rb_bug_errno("native_atfork", r);
-    }
-}
-
 #define native_cleanup_push pthread_cleanup_push
 #define native_cleanup_pop  pthread_cleanup_pop
 #ifdef HAVE_SCHED_YIELD

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]