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

ruby-changes:41341

From: normal <ko1@a...>
Date: Sat, 2 Jan 2016 21:08:31 +0900 (JST)
Subject: [ruby-changes:41341] normal:r53413 (trunk): thread_sync.c: remove unnecessary casts for queue_sleep

normal	2016-01-02 21:08:34 +0900 (Sat, 02 Jan 2016)

  New Revision: 53413

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53413

  Log:
    thread_sync.c: remove unnecessary casts for queue_sleep
    
    "Qfalse" and "(VALUE)0" are equivalent, and do not matter
    for an ignored argument, either.
    
    Additionally, there's no reason to cast the pointer to
    rb_thread_sleep_deadly when we already have a queue_sleep
    wrapper.
    
    * thread_sync.c (queue_do_pop): avoid cast with Qfalse
      (rb_szqueue_push): ditto, use queue_sleep wrapper

  Modified files:
    trunk/ChangeLog
    trunk/thread_sync.c
Index: thread_sync.c
===================================================================
--- thread_sync.c	(revision 53412)
+++ thread_sync.c	(revision 53413)
@@ -786,7 +786,7 @@ queue_do_pop(VALUE self, int should_bloc https://github.com/ruby/ruby/blob/trunk/thread_sync.c#L786
 	    assert(queue_closed_p(self) == 0);
 
 	    rb_ary_push(args.waiting, args.th);
-	    rb_ensure(queue_sleep, (VALUE)0, queue_delete_from_waiting, (VALUE)&args);
+	    rb_ensure(queue_sleep, Qfalse, queue_delete_from_waiting, (VALUE)&args);
 	}
     }
 
@@ -1012,7 +1012,7 @@ rb_szqueue_push(int argc, VALUE *argv, V https://github.com/ruby/ruby/blob/trunk/thread_sync.c#L1012
 	}
 	else {
 	    rb_ary_push(args.waiting, args.th);
-	    rb_ensure((VALUE (*)())rb_thread_sleep_deadly, (VALUE)0, queue_delete_from_waiting, (VALUE)&args);
+	    rb_ensure(queue_sleep, Qfalse, queue_delete_from_waiting, (VALUE)&args);
 	}
     }
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53412)
+++ ChangeLog	(revision 53413)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Jan  2 21:07:55 2016  Eric Wong  <e@8...>
+
+	* thread_sync.c (queue_do_pop): avoid cast with Qfalse
+	  (rb_szqueue_push): ditto, use queue_sleep wrapper
+
 Sat Jan  2 16:16:14 2016  Masatoshi SEKI  <m_seki@m...>
 
 	* lib/erb.rb: Allow ERB subclass to add token easily.

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

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