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

thread.c: revert r38382 but deprecate rb_thread_polling()

* thread.c (rb_thread_polling): revert but deprecate.
* include/ruby/intern.h (rb_thread_polling): deprecate.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-12-15 01:22:44 +00:00
parent cb6917d913
commit ce6a2c7fac
3 changed files with 26 additions and 5 deletions

View file

@ -1,3 +1,9 @@
Sat Dec 15 10:22:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* thread.c (rb_thread_polling): revert but deprecate.
* include/ruby/intern.h (rb_thread_polling): deprecate.
Sat Dec 15 08:37:01 2012 Masaya Tarui <tarui@ruby-lang.org>
* test/rubygems/test_gem_ext_cmake_builder.rb(test_self_build):
@ -31,10 +37,6 @@ Sat Dec 15 06:15:14 2012 Eric Hodel <drbrain@segment7.net>
__sync_val_compare_and_swap. Patch by KOSAKI Motohiro.
[ruby-trunk - Bug #7485]
Sat Dec 15 04:25:11 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* include/ruby/intern.h: remove rb_thread_polling() declaration.
Sat Dec 15 03:42:34 2012 Naohisa Goto <ngotogenome@gmail.com>
* ext/.document: add fiddle/pointer.c, fiddle/handle.c, and

View file

@ -394,7 +394,7 @@ void rb_thread_wait_fd(int);
int rb_thread_fd_writable(int);
void rb_thread_fd_close(int);
int rb_thread_alone(void);
void rb_thread_polling(void);
DEPRECATED(void rb_thread_polling(void));
void rb_thread_sleep(int);
void rb_thread_sleep_forever(void);
VALUE rb_thread_stop(void);

View file

@ -994,6 +994,15 @@ sleep_wait_for_interrupt(rb_thread_t *th, double sleepsec,int spurious_check)
sleep_timeval(th, double2timeval(sleepsec),spurious_check);
}
static void
sleep_for_polling(rb_thread_t *th)
{
struct timeval time;
time.tv_sec = 0;
time.tv_usec = 100 * 1000; /* 0.1 sec */
sleep_timeval(th, time, 1);
}
void
rb_thread_wait_for(struct timeval time)
{
@ -1001,6 +1010,16 @@ rb_thread_wait_for(struct timeval time)
sleep_timeval(th, time, 1);
}
void
rb_thread_polling(void)
{
if (!rb_thread_alone()) {
rb_thread_t *th = GET_THREAD();
RUBY_VM_CHECK_INTS_BLOCKING(th);
sleep_for_polling(th);
}
}
/*
* CAUTION: This function causes thread switching.
* rb_thread_check_ints() check ruby's interrupts.