Skip to content

Commit

Permalink
change thread's status during blocking with select. fix #1425
Browse files Browse the repository at this point in the history
  • Loading branch information
Watson1978 committed Dec 1, 2011
1 parent bc2f90c commit fff9e91
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 14 deletions.
@@ -1,3 +0,0 @@
critical:BasicSocket#recv receives a specified number of bytes of a message from another socket
critical:BasicSocket#recv accepts flags to specify unusual receiving behaviour
critical:BasicSocket#recv gets lines delimited with a custom separator
@@ -1,3 +0,0 @@
critical:BasicSocket#send sends a message to another socket and returns the number of bytes sent
critical:BasicSocket#send accepts flags to specify unusual sending behaviour
critical:BasicSocket#send accepts a sockaddr as recipient address
@@ -1,2 +0,0 @@
critical:Socket#connect_nonblock connects the socket to the remote side
critical:Socket#connect_nonblock takes an encoded socket address and starts the connection to it
@@ -1 +0,0 @@
critical:Socket::TCPServer.accept_nonblock accepts non blocking connections
@@ -1,3 +1,2 @@
critical:TCPServer#accept accepts a connection and returns a TCPSocket
critical:TCPServer#accept can be interrupted by Thread#kill
critical:TCPServer#accept can be interrupted by Thread#raise
@@ -1,2 +0,0 @@
critical:TCPSocket.new connects to a listening server
critical:TCPSocket.new has an address once it has connected to a listening server
@@ -1,2 +0,0 @@
critical:TCPSocket.open connects to a listening server
critical:TCPSocket.open has an address once it has connected to a listening server
4 changes: 4 additions & 0 deletions thread.c
Expand Up @@ -1082,10 +1082,14 @@ do_select(int n, fd_set *read, fd_set *write, fd_set *except,
retry:
lerrno = 0;

rb_vm_thread_t *thread = GetThreadPtr(rb_vm_current_thread());
rb_vm_thread_status_t prev_status = thread->status;
thread->status = THREAD_SLEEP;
//BLOCKING_REGION({
result = select(n, read, write, except, timeout);
if (result < 0) lerrno = errno;
//}, ubf_select, GET_THREAD());
thread->status = prev_status;

errno = lerrno;

Expand Down

0 comments on commit fff9e91

Please sign in to comment.