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

ruby-changes:22245

From: nobu <ko1@a...>
Date: Fri, 13 Jan 2012 18:29:25 +0900 (JST)
Subject: [ruby-changes:22245] nobu:r34294 (trunk): * thread.c (rb_mutex_unlock_th): simplified.

nobu	2012-01-13 18:29:13 +0900 (Fri, 13 Jan 2012)

  New Revision: 34294

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

  Log:
    * thread.c (rb_mutex_unlock_th): simplified.

  Modified files:
    trunk/ChangeLog
    trunk/thread.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 34293)
+++ ChangeLog	(revision 34294)
@@ -1,5 +1,7 @@
-Fri Jan 13 18:25:49 2012  Nobuyoshi Nakada  <nobu@r...>
+Fri Jan 13 18:29:06 2012  Nobuyoshi Nakada  <nobu@r...>
 
+	* thread.c (rb_mutex_unlock_th): simplified.
+
 	* thread.c (rb_barrier_waiting): fix potential overflows.
 
 Fri Jan 13 17:23:38 2012  Nobuyoshi Nakada  <nobu@r...>
Index: thread.c
===================================================================
--- thread.c	(revision 34293)
+++ thread.c	(revision 34294)
@@ -3523,7 +3523,6 @@
 rb_mutex_unlock_th(rb_mutex_t *mutex, rb_thread_t volatile *th)
 {
     const char *err = NULL;
-    rb_mutex_t *th_mutex;
 
     native_mutex_lock(&mutex->lock);
 
@@ -3542,21 +3541,11 @@
     native_mutex_unlock(&mutex->lock);
 
     if (!err) {
-	th_mutex = th->keeping_mutexes;
-	if (th_mutex == mutex) {
-	    th->keeping_mutexes = mutex->next_mutex;
+	rb_mutex_t *volatile *th_mutex = &th->keeping_mutexes;
+	while (*th_mutex != mutex) {
+	    th_mutex = &(*th_mutex)->next_mutex;
 	}
-	else {
-	    while (1) {
-		rb_mutex_t *tmp_mutex;
-		tmp_mutex = th_mutex->next_mutex;
-		if (tmp_mutex == mutex) {
-		    th_mutex->next_mutex = tmp_mutex->next_mutex;
-		    break;
-		}
-		th_mutex = tmp_mutex;
-	    }
-	}
+	*th_mutex = mutex->next_mutex;
 	mutex->next_mutex = NULL;
     }
 

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

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