summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--ext/socket/socket.c2
-rw-r--r--file.c2
-rw-r--r--include/ruby/intern.h3
-rw-r--r--io.c8
-rw-r--r--process.c4
-rw-r--r--thread.c4
7 files changed, 20 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 19cf20a03e..b73bde59c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/file.c b/file.c
index 527cd75059..4e6145e0df 100644
--- a/file.c
+++ b/file.c
@@ -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);
diff --git a/io.c b/io.c
index 645df164cb..da427ef833 100644
--- a/io.c
+++ b/io.c
@@ -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
diff --git a/process.c b/process.c
index 22a889d9fd..5b54180683 100644
--- a/process.c
+++ b/process.c
@@ -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();
diff --git a/thread.c b/thread.c
index 14c2a89e42..8b7f6364f7 100644
--- a/thread.c
+++ b/thread.c
@@ -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;
}