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

ruby-changes:20218

From: ko1 <ko1@a...>
Date: Tue, 28 Jun 2011 11:53:21 +0900 (JST)
Subject: [ruby-changes:20218] ko1:r32266 (trunk): * thread_pthread.c (consume_communication_pipe):

ko1	2011-06-28 11:53:15 +0900 (Tue, 28 Jun 2011)

  New Revision: 32266

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

  Log:
    * thread_pthread.c (consume_communication_pipe):
      Make "buff" as static.  (Maybe) "buff" can be shared between
      any caller (any threads) because no one use the read values.
      And remove const value "buff_size", and define CCP_READ_BUFF_SIZE
      macro.

  Modified files:
    trunk/ChangeLog
    trunk/thread_pthread.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 32265)
+++ ChangeLog	(revision 32266)
@@ -1,3 +1,11 @@
+Tue Jun 28 11:49:14 2011  Koichi Sasada  <ko1@a...>
+
+	* thread_pthread.c (consume_communication_pipe): 
+	  Make "buff" as static.  (Maybe) "buff" can be shared between
+	  any caller (any threads) because no one use the read values.
+	  And remove const value "buff_size", and define CCP_READ_BUFF_SIZE
+	  macro.
+
 Tue Jun 28 11:45:30 2011  Eric Hodel  <drbrain@s...>
 
 	* lib/rake:  Update rake to fix some bugs and hide deprecated features
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 32265)
+++ thread_pthread.c	(revision 32266)
@@ -1021,15 +1021,13 @@
 static void
 consume_communication_pipe(void)
 {
-    const size_t buff_size = 1024;
-#ifdef __FreeBSD__
-    char buff[buff_size];
-#else
-    char buff[1024];
-#endif
+#define CCP_READ_BUFF_SIZE 1024
+    /* buffer can be shared because no one refers to them. */
+    static char buff[CCP_READ_BUFF_SIZE]; 
     ssize_t result;
+
   retry:
-    result = read(timer_thread_pipe[0], buff, buff_size);
+    result = read(timer_thread_pipe[0], buff, CCP_READ_BUFF_SIZE);
     if (result < 0) {
 	switch (errno) {
 	  case EINTR: goto retry;

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

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