diff options
author | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-04-30 16:08:20 +0000 |
---|---|---|
committer | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-04-30 16:08:20 +0000 |
commit | 4d88169267a8614c36e9fbe389dd3fadba25cdc5 (patch) | |
tree | 777648b563c7f86387cce9a31b6bf50175aff0f1 | |
parent | 3cea846e426bffab9fd22846b6464787359ee63d (diff) |
* thread.c (rb_thread_select): release GVL while waiting select().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | thread.c | 12 |
2 files changed, 15 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Sun May 1 01:06:24 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com> + + * thread.c (rb_thread_select): release GVL while waiting select(). + Sat Apr 30 23:10:15 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com> * win32/win32.c (rb_w32_fdcopy): New. This can copy even though @@ -2672,7 +2672,17 @@ rb_thread_select(int max, fd_set * read, fd_set * write, fd_set * except, return 0; } else { - return select(max, read, write, except, timeout); + int lerrno; + int result; + + BLOCKING_REGION({ + result = select(max, read, write, except, timeout); + if (result < 0) + lerrno = errno; + }, ubf_select, GET_THREAD()); + errno = lerrno; + + return result; } } |