[前][次][番号順一覧][スレッド一覧]

ruby-changes:26340

From: nobu <ko1@a...>
Date: Sat, 15 Dec 2012 10:23:39 +0900 (JST)
Subject: [ruby-changes:26340] nobu:r38391 (trunk): thread.c: revert r38382 but deprecate rb_thread_polling()

nobu	2012-12-15 10:22:44 +0900 (Sat, 15 Dec 2012)

  New Revision: 38391

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38391

  Log:
    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.

  Modified files:
    trunk/ChangeLog
    trunk/include/ruby/intern.h
    trunk/thread.c

Index: include/ruby/intern.h
===================================================================
--- include/ruby/intern.h	(revision 38390)
+++ include/ruby/intern.h	(revision 38391)
@@ -394,7 +394,7 @@ void rb_thread_wait_fd(int); https://github.com/ruby/ruby/blob/trunk/include/ruby/intern.h#L394
 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);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38390)
+++ ChangeLog	(revision 38391)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Dec 15 10:22:38 2012  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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@r...>
 
 	* test/rubygems/test_gem_ext_cmake_builder.rb(test_self_build):
@@ -31,10 +37,6 @@ Sat Dec 15 06:15:14 2012  Eric Hodel  <d https://github.com/ruby/ruby/blob/trunk/ChangeLog#L37
 	  __sync_val_compare_and_swap.  Patch by KOSAKI Motohiro.
 	  [ruby-trunk - Bug #7485]
 
-Sat Dec 15 04:25:11 2012  KOSAKI Motohiro  <kosaki.motohiro@g...>
-
-	* include/ruby/intern.h: remove rb_thread_polling() declaration.
-
 Sat Dec 15 03:42:34 2012  Naohisa Goto  <ngotogenome@g...>
 
 	* ext/.document: add fiddle/pointer.c, fiddle/handle.c, and
Index: thread.c
===================================================================
--- thread.c	(revision 38390)
+++ thread.c	(revision 38391)
@@ -994,6 +994,15 @@ sleep_wait_for_interrupt(rb_thread_t *th https://github.com/ruby/ruby/blob/trunk/thread.c#L994
     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) https://github.com/ruby/ruby/blob/trunk/thread.c#L1010
     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.

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]