1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* include/ruby/intern.h (rb_thread_select): mark as deprecated.

* ext/io/wait/wait.c (wait_readable): use rb_thread_fd_select
  instead of rb_thread_select.
* ext/socket/init.c (wait_connectable0): ditto.
* ext/readline/readline.c (readline_event): ditto.
* io.c (rb_io_wait_readable, wait_readable, rb_io_wait_writable,
  wait_writable): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kosaki 2011-04-30 11:15:15 +00:00
parent 4c926e9f15
commit 2d2544c8e6
6 changed files with 23 additions and 12 deletions

View file

@ -1,3 +1,14 @@
Sat Apr 30 20:11:47 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* include/ruby/intern.h (rb_thread_select): mark as deprecated.
* ext/io/wait/wait.c (wait_readable): use rb_thread_fd_select
instead of rb_thread_select.
* ext/socket/init.c (wait_connectable0): ditto.
* ext/readline/readline.c (readline_event): ditto.
* io.c (rb_io_wait_readable, wait_readable, rb_io_wait_writable,
wait_writable): ditto.
Sat Apr 30 20:06:36 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* thread.c (do_select): remove useless ifdef. time calculation

View file

@ -100,7 +100,7 @@ wait_readable(VALUE p)
struct wait_readable_arg *arg = (struct wait_readable_arg *)p;
rb_fdset_t *fds = &arg->fds;
return (VALUE)rb_thread_select(rb_fd_max(fds), rb_fd_ptr(fds), NULL, NULL, arg->timeout);
return (VALUE)rb_thread_fd_select(rb_fd_max(fds), fds, NULL, NULL, arg->timeout);
}
#endif
@ -143,7 +143,7 @@ io_wait(int argc, VALUE *argv, VALUE io)
i = (int)rb_ensure(wait_readable, (VALUE)&arg,
(VALUE (*)_((VALUE)))rb_fd_term, (VALUE)&arg.fds);
#else
i = rb_thread_select(fd + 1, rb_fd_ptr(&arg.fds), NULL, NULL, arg.timeout);
i = rb_thread_fd_select(fd + 1, &arg.fds, NULL, NULL, arg.timeout);
#endif
if (i < 0)
rb_sys_fail(0);

View file

@ -145,11 +145,11 @@ readline_event(void)
#if BUSY_WAIT
rb_thread_schedule();
#else
fd_set rset;
rb_fdset_t fds;
FD_ZERO(&rset);
FD_SET(fileno(rl_instream), &rset);
rb_thread_select(fileno(rl_instream) + 1, &rset, NULL, NULL, NULL);
rb_fd_init(fds);
rb_fd_set(fileno(rl_instream), &fds);
rb_thread_fd_select(fileno(rl_instream) + 1, &fds, NULL, NULL, NULL);
return 0;
#endif
}

View file

@ -266,7 +266,7 @@ wait_connectable0(int fd, rb_fdset_t *fds_w, rb_fdset_t *fds_e)
rb_fd_set(fd, fds_w);
rb_fd_set(fd, fds_e);
rb_thread_select(fd+1, 0, rb_fd_ptr(fds_w), rb_fd_ptr(fds_e), 0);
rb_thread_fd_select(fd+1, 0, fds_w, fds_e, 0);
if (rb_fd_isset(fd, fds_w)) {
return 0;

View file

@ -369,7 +369,7 @@ VALUE rb_thread_wakeup_alive(VALUE);
VALUE rb_thread_run(VALUE);
VALUE rb_thread_kill(VALUE);
VALUE rb_thread_create(VALUE (*)(ANYARGS), void*);
int rb_thread_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
DEPRECATED(int rb_thread_select(int, fd_set *, fd_set *, fd_set *, struct timeval *));
int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
void rb_thread_wait_for(struct timeval);
VALUE rb_thread_current(void);

8
io.c
View file

@ -691,7 +691,7 @@ wait_readable(VALUE p)
{
rb_fdset_t *rfds = (rb_fdset_t *)p;
return rb_thread_select(rb_fd_max(rfds), rb_fd_ptr(rfds), NULL, NULL, NULL);
return rb_thread_fd_select(rb_fd_max(rfds), rfds, NULL, NULL, NULL);
}
#endif
@ -721,7 +721,7 @@ rb_io_wait_readable(int f)
rb_ensure(wait_readable, (VALUE)&rfds,
(VALUE (*)(VALUE))rb_fd_term, (VALUE)&rfds);
#else
rb_thread_select(f + 1, rb_fd_ptr(&rfds), NULL, NULL, NULL);
rb_thread_fd_select(f + 1, &rfds, NULL, NULL, NULL);
#endif
return TRUE;
@ -736,7 +736,7 @@ wait_writable(VALUE p)
{
rb_fdset_t *wfds = (rb_fdset_t *)p;
return rb_thread_select(rb_fd_max(wfds), NULL, rb_fd_ptr(wfds), NULL, NULL);
return rb_thread_fd_select(rb_fd_max(wfds), NULL, wfds, NULL, NULL);
}
#endif
@ -766,7 +766,7 @@ rb_io_wait_writable(int f)
rb_ensure(wait_writable, (VALUE)&wfds,
(VALUE (*)(VALUE))rb_fd_term, (VALUE)&wfds);
#else
rb_thread_select(f + 1, NULL, rb_fd_ptr(&wfds), NULL, NULL);
rb_thread_fd_select(f + 1, NULL, &wfds, NULL, NULL);
#endif
return TRUE;