ruby-changes:24171
From: ko1 <ko1@a...>
Date: Tue, 26 Jun 2012 17:01:45 +0900 (JST)
Subject: [ruby-changes:24171] ko1:r36222 (trunk): * thread_pthread.c (register_cached_thread_and_wait):
ko1 2012-06-26 17:01:35 +0900 (Tue, 26 Jun 2012) New Revision: 36222 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36222 Log: * thread_pthread.c (register_cached_thread_and_wait): return immediately if malloc() failed. [ruby-core:43960] [ruby-trunk - Bug #6235] * thread_pthread.c (USE_THREAD_CACHE): check already defined or not. Modified files: trunk/ChangeLog trunk/thread_pthread.c Index: ChangeLog =================================================================== --- ChangeLog (revision 36221) +++ ChangeLog (revision 36222) @@ -1,3 +1,11 @@ +Tue Jun 26 16:57:14 2012 Koichi Sasada <ko1@a...> + + * thread_pthread.c (register_cached_thread_and_wait): + return immediately if malloc() failed. + [ruby-core:43960] [ruby-trunk - Bug #6235] + + * thread_pthread.c (USE_THREAD_CACHE): check already defined or not. + Tue Jun 26 10:01:56 2012 Nobuyoshi Nakada <nobu@r...> * io.c (rb_io_s_popen): revert r36213 "popen: shell commands with Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 36221) +++ thread_pthread.c (revision 36222) @@ -480,7 +480,9 @@ #endif } +#ifndef USE_THREAD_CACHE #define USE_THREAD_CACHE 0 +#endif #if USE_THREAD_CACHE static rb_thread_t *register_cached_thread_and_wait(void); @@ -717,11 +719,15 @@ { rb_thread_cond_t cond = { PTHREAD_COND_INITIALIZER, }; volatile rb_thread_t *th_area = 0; + struct timeval tv; + struct timespec ts; struct cached_thread_entry *entry = (struct cached_thread_entry *)malloc(sizeof(struct cached_thread_entry)); - struct timeval tv; - struct timespec ts; + if (entry == 0) { + return 0; /* failed -> terminate thread immediately */ + } + gettimeofday(&tv, 0); ts.tv_sec = tv.tv_sec + 60; ts.tv_nsec = tv.tv_usec * 1000; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/