* 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
This commit is contained in:
ko1 2008-08-31 07:44:24 +00:00
Родитель d427cf3af8
Коммит ca6a8b1e2c
7 изменённых файлов: 20 добавлений и 11 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

2
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:

Просмотреть файл

@ -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);

8
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

Просмотреть файл

@ -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;
}