ruby-changes:46689
From: normal <ko1@a...>
Date: Sat, 20 May 2017 03:34:43 +0900 (JST)
Subject: [ruby-changes:46689] normal:r58804 (trunk): thread_sync.c: rename mutex_waiter struct to sync_waiter
normal 2017-05-20 03:34:38 +0900 (Sat, 20 May 2017) New Revision: 58804 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58804 Log: thread_sync.c: rename mutex_waiter struct to sync_waiter We will reuse this struct for ConditionVariable, Queue, and SizedQueue, so it is no longer Mutex-specific. Modified files: trunk/thread_sync.c Index: thread_sync.c =================================================================== --- thread_sync.c (revision 58803) +++ thread_sync.c (revision 58804) @@ -6,8 +6,8 @@ static VALUE rb_eClosedQueueError; https://github.com/ruby/ruby/blob/trunk/thread_sync.c#L6 /* Mutex */ -/* mutex_waiter is always on-stack */ -struct mutex_waiter { +/* sync_waiter is always on-stack */ +struct sync_waiter { rb_thread_t *th; struct list_node node; }; @@ -60,7 +60,7 @@ static const char* rb_mutex_unlock_th(rb https://github.com/ruby/ruby/blob/trunk/thread_sync.c#L60 static size_t rb_mutex_num_waiting(rb_mutex_t *mutex) { - struct mutex_waiter *w = 0; + struct sync_waiter *w = 0; size_t n = 0; list_for_each(&mutex->waitq, w, node) { @@ -213,7 +213,7 @@ rb_mutex_lock(VALUE self) https://github.com/ruby/ruby/blob/trunk/thread_sync.c#L213 } if (rb_mutex_trylock(self) == Qfalse) { - struct mutex_waiter w; + struct sync_waiter w; if (mutex->th == th) { rb_raise(rb_eThreadError, "deadlock; recursive locking"); @@ -300,7 +300,7 @@ rb_mutex_unlock_th(rb_mutex_t *mutex, rb https://github.com/ruby/ruby/blob/trunk/thread_sync.c#L300 err = "Attempt to unlock a mutex which is locked by another thread"; } else { - struct mutex_waiter *cur = 0, *next = 0; + struct sync_waiter *cur = 0, *next = 0; rb_mutex_t *volatile *th_mutex = &th->keeping_mutexes; mutex->th = 0; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/