From 44e48eca5ffaa2ca70161e6e1cde347d64aa2ed2 Mon Sep 17 00:00:00 2001 From: normal Date: Fri, 19 May 2017 18:34:38 +0000 Subject: [PATCH] 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread_sync.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/thread_sync.c b/thread_sync.c index d33b22173f..b702f6aab0 100644 --- a/thread_sync.c +++ b/thread_sync.c @@ -6,8 +6,8 @@ static VALUE rb_eClosedQueueError; /* 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_mutex_t *mutex, rb_thread_t volatile *t 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) } 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_thread_t volatile *th) 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;