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

ruby-changes:39696

From: nobu <ko1@a...>
Date: Mon, 7 Sep 2015 00:20:04 +0900 (JST)
Subject: [ruby-changes:39696] nobu:r51777 (trunk): thread_pthread.c: async bug messages

nobu	2015-09-07 00:19:47 +0900 (Mon, 07 Sep 2015)

  New Revision: 51777

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

  Log:
    thread_pthread.c: async bug messages
    
    * thread_pthread.c (consume_communication_pipe, CLOSE_INVALIDATE):
      adjust async bug messages.

  Modified files:
    trunk/thread_pthread.c
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 51776)
+++ thread_pthread.c	(revision 51777)
@@ -1294,7 +1294,7 @@ rb_thread_wakeup_timer_thread_fd(volatil https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1294
 
     /* already opened */
     if (fd >= 0 && timer_thread_pipe.owner_process == getpid()) {
-	const char *buff = "!";
+	static const char buff[1] = {'!'};
       retry:
 	if ((result = write(fd, buff, 1)) <= 0) {
 	    int e = errno;
@@ -1358,13 +1358,14 @@ consume_communication_pipe(int fd) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1358
 #endif
 		return;
 	      default:
-		rb_async_bug_errno("consume_communication_pipe: read\n", e);
+		rb_async_bug_errno("consume_communication_pipe: read", e);
 	    }
 	}
     }
 }
 
-#define CLOSE_INVALIDATE(expr) close_invalidate(&expr,#expr)
+#define CLOSE_INVALIDATE(expr) \
+    close_invalidate(&timer_thread_pipe.expr,"close_invalidate: "#expr)
 static void
 close_invalidate(volatile int *fdp, const char *msg)
 {
@@ -1424,8 +1425,8 @@ setup_communication_pipe(void) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1425
     }
     if (setup_communication_pipe_internal(timer_thread_pipe.low) < 0) {
 	int e = errno;
-	CLOSE_INVALIDATE(timer_thread_pipe.normal[0]);
-	CLOSE_INVALIDATE(timer_thread_pipe.normal[1]);
+	CLOSE_INVALIDATE(normal[0]);
+	CLOSE_INVALIDATE(normal[1]);
 	return e;
     }
 
@@ -1569,8 +1570,8 @@ thread_timer(void *p) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1570
 	timer_thread_sleep(gvl);
     }
 #if USE_SLEEPY_TIMER_THREAD
-    CLOSE_INVALIDATE(timer_thread_pipe.normal[0]);
-    CLOSE_INVALIDATE(timer_thread_pipe.low[0]);
+    CLOSE_INVALIDATE(normal[0]);
+    CLOSE_INVALIDATE(low[0]);
 #else
     native_mutex_unlock(&timer_thread_lock);
     native_cond_destroy(&timer_thread_cond);
@@ -1631,10 +1632,10 @@ rb_thread_create_timer_thread(void) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1632
 	if (err != 0) {
 	    rb_warn("pthread_create failed for timer: %s, scheduling broken",
 		    strerror(err));
-	    CLOSE_INVALIDATE(timer_thread_pipe.normal[0]);
-	    CLOSE_INVALIDATE(timer_thread_pipe.normal[1]);
-	    CLOSE_INVALIDATE(timer_thread_pipe.low[0]);
-	    CLOSE_INVALIDATE(timer_thread_pipe.low[1]);
+	    CLOSE_INVALIDATE(normal[0]);
+	    CLOSE_INVALIDATE(normal[1]);
+	    CLOSE_INVALIDATE(low[0]);
+	    CLOSE_INVALIDATE(low[1]);
 	    return;
 	}
 	timer_thread.created = 1;
@@ -1665,8 +1666,8 @@ native_stop_timer_thread(void) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1666
 	}
 
 	/* stop writing ends of pipes so timer thread notices EOF */
-	CLOSE_INVALIDATE(timer_thread_pipe.normal[1]);
-	CLOSE_INVALIDATE(timer_thread_pipe.low[1]);
+	CLOSE_INVALIDATE(normal[1]);
+	CLOSE_INVALIDATE(low[1]);
 
 	/* timer thread will stop looping when system_working <= 0: */
 	native_thread_join(timer_thread.id);

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

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