summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-28 02:53:15 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-28 02:53:15 +0000
commit014a5f31789856f9ed7a59f19fb3c3e544655a7d (patch)
tree70f782dd54185b40a5d3259d17edce98e9612de6
parent2619f216fef06c9fca948ca729a0e23b62996f09 (diff)
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--thread_pthread.c12
2 files changed, 13 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 45332bfd1f..1143be6b20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Tue Jun 28 11:49:14 2011 Koichi Sasada <ko1@atdot.net>
+
+ * 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@segment7.net>
* lib/rake: Update rake to fix some bugs and hide deprecated features
diff --git a/thread_pthread.c b/thread_pthread.c
index 5726e3ba93..e78c10fb46 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -1021,15 +1021,13 @@ rb_thread_wakeup_timer_thread(void)
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;