diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-31 07:44:24 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-31 07:44:24 +0000 |
commit | ca6a8b1e2c9e1832ab993edff48d2d3a9234a4b3 (patch) | |
tree | 09e15151427ce2b817813bb7bde1f0d9cf1a2c75 | |
parent | d427cf3af8dfc1af85e6e0f3a7d8a86dd7f2d35f (diff) |
* include/ruby/intern.h: rename RB_UBF_DFL to
RUBY_UBF_IO and RUBY_UBF_PROCESS.
Because there is no default (universal) unblocking function.
* ext/socket/socket.c, file.c, io.c, process.c, thread.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | ext/socket/socket.c | 2 | ||||
-rw-r--r-- | file.c | 2 | ||||
-rw-r--r-- | include/ruby/intern.h | 3 | ||||
-rw-r--r-- | io.c | 8 | ||||
-rw-r--r-- | process.c | 4 | ||||
-rw-r--r-- | thread.c | 4 |
7 files changed, 20 insertions, 11 deletions
@@ -1,3 +1,11 @@ +Sun Aug 31 16:43:56 2008 Koichi Sasada <ko1@atdot.net> + + * include/ruby/intern.h: rename RB_UBF_DFL to + RUBY_UBF_IO and RUBY_UBF_PROCESS. + Because there is no default (universal) unblocking function. + + * ext/socket/socket.c, file.c, io.c, process.c, thread.c: ditto. + Sun Aug 31 16:42:23 2008 Tanaka Akira <akr@fsij.org> * transcode.c (econv_insert_output): raise ArgumentError on failure. diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 57d0ae69fd..2dcc168075 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -102,7 +102,7 @@ int Rconnect(); #endif #endif -#define BLOCKING_REGION(func, arg) (long)rb_thread_blocking_region((func), (arg), RB_UBF_DFL, 0) +#define BLOCKING_REGION(func, arg) (long)rb_thread_blocking_region((func), (arg), RUBY_UBF_IO, 0) #define INET_CLIENT 0 #define INET_SERVER 1 @@ -3472,7 +3472,7 @@ rb_file_flock(VALUE obj, VALUE operation) if (fptr->mode & FMODE_WRITABLE) { rb_io_flush(obj); } - while ((int)rb_thread_blocking_region(rb_thread_flock, op, RB_UBF_DFL, 0) < 0) { + while ((int)rb_thread_blocking_region(rb_thread_flock, op, RUBY_UBF_IO, 0) < 0) { switch (errno) { case EAGAIN: case EACCES: diff --git a/include/ruby/intern.h b/include/ruby/intern.h index b162375210..95e70c52be 100644 --- a/include/ruby/intern.h +++ b/include/ruby/intern.h @@ -661,7 +661,8 @@ typedef VALUE rb_blocking_function_t(void *); void rb_thread_check_ints(void); VALUE rb_thread_blocking_region(rb_blocking_function_t *func, void *data1, rb_unblock_function_t *ubf, void *data2); -#define RB_UBF_DFL ((rb_unblock_function_t *)-1) +#define RUBY_UBF_IO ((rb_unblock_function_t *)-1) +#define RUBY_UBF_PROCESS ((rb_unblock_function_t *)-1) VALUE rb_mutex_new(void); VALUE rb_mutex_locked_p(VALUE mutex); VALUE rb_mutex_try_lock(VALUE mutex); @@ -524,7 +524,7 @@ rb_read_internal(int fd, void *buf, size_t count) iis.buf = buf; iis.capa = count; - return rb_thread_blocking_region(internal_read_func, &iis, RB_UBF_DFL, 0); + return rb_thread_blocking_region(internal_read_func, &iis, RUBY_UBF_IO, 0); } static int @@ -535,7 +535,7 @@ rb_write_internal(int fd, void *buf, size_t count) iis.buf = buf; iis.capa = count; - return rb_thread_blocking_region(internal_write_func, &iis, RB_UBF_DFL, 0); + return rb_thread_blocking_region(internal_write_func, &iis, RUBY_UBF_IO, 0); } static int @@ -3925,7 +3925,7 @@ rb_sysopen_internal(char *fname, int flags, mode_t mode) data.fname = fname; data.flag = flags; data.mode = mode; - return (int)rb_thread_blocking_region(sysopen_func, &data, RB_UBF_DFL, 0); + return (int)rb_thread_blocking_region(sysopen_func, &data, RUBY_UBF_IO, 0); } static int @@ -7372,7 +7372,7 @@ copy_stream_body(VALUE arg) rb_fd_set(src_fd, &stp->fds); rb_fd_set(dst_fd, &stp->fds); - return rb_thread_blocking_region(copy_stream_func, (void*)stp, RB_UBF_DFL, 0); + return rb_thread_blocking_region(copy_stream_func, (void*)stp, RUBY_UBF_IO, 0); } static VALUE @@ -633,7 +633,7 @@ rb_waitpid(rb_pid_t pid, int *st, int flags) arg.st = st; arg.flags = flags; result = (rb_pid_t)rb_thread_blocking_region(rb_waitpid_blocking, &arg, - RB_UBF_DFL, 0); + RUBY_UBF_PROCESS, 0); if (result < 0) { #if 0 if (errno == EINTR) { @@ -656,7 +656,7 @@ rb_waitpid(rb_pid_t pid, int *st, int flags) for (;;) { result = (rb_pid_t)rb_thread_blocking_region(rb_waitpid_blocking, - st, RB_UBF_DFL); + st, RUBY_UBF_PROCESS); if (result < 0) { if (errno == EINTR) { rb_thread_schedule(); @@ -931,8 +931,8 @@ rb_thread_blocking_region( VALUE val; rb_thread_t *th = GET_THREAD(); - if (ubf == RB_UBF_DFL) { - ubf = ubf_select; + if (ubf == RUBY_UBF_IO || ubf == RUBY_UBF_PROCESS) { + ubf = ubf_select;n data2 = th; } |