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

ruby-changes:48695

From: k0kubun <ko1@a...>
Date: Thu, 16 Nov 2017 19:02:09 +0900 (JST)
Subject: [ruby-changes:48695] k0kubun:r60811 (trunk): thread_win32.c: stop returning unused value

k0kubun	2017-11-16 19:02:03 +0900 (Thu, 16 Nov 2017)

  New Revision: 60811

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

  Log:
    thread_win32.c: stop returning unused value
    
    to unify signature with pthread's one
    
    I'm planning to use functions for rb_nativethread_cond_t and
    rb_nativethread_mutex_t in the future JIT introduction.
    
    In that case, I want them to have the same signature. To prevent the case
    that its return value is used in somewhere and it becomes harder to unify
    signature, I want to drop unused return value.
    
    [close GH-1751]

  Modified files:
    trunk/thread_win32.c
Index: thread_win32.c
===================================================================
--- thread_win32.c	(revision 60810)
+++ thread_win32.c	(revision 60811)
@@ -24,8 +24,8 @@ https://github.com/ruby/ruby/blob/trunk/thread_win32.c#L24
 static volatile DWORD ruby_native_thread_key = TLS_OUT_OF_INDEXES;
 
 static int w32_wait_events(HANDLE *events, int count, DWORD timeout, rb_thread_t *th);
-static int native_mutex_lock(rb_nativethread_lock_t *lock);
-static int native_mutex_unlock(rb_nativethread_lock_t *lock);
+static void native_mutex_lock(rb_nativethread_lock_t *lock);
+static void native_mutex_unlock(rb_nativethread_lock_t *lock);
 
 static void
 w32_error(const char *func)
@@ -302,7 +302,7 @@ native_sleep(rb_thread_t *th, struct tim https://github.com/ruby/ruby/blob/trunk/thread_win32.c#L302
     GVL_UNLOCK_END();
 }
 
-static int
+static void
 native_mutex_lock(rb_nativethread_lock_t *lock)
 {
 #if USE_WIN32_MUTEX
@@ -310,18 +310,16 @@ native_mutex_lock(rb_nativethread_lock_t https://github.com/ruby/ruby/blob/trunk/thread_win32.c#L310
 #else
     EnterCriticalSection(&lock->crit);
 #endif
-    return 0;
 }
 
-static int
+static void
 native_mutex_unlock(rb_nativethread_lock_t *lock)
 {
 #if USE_WIN32_MUTEX
     thread_debug("release mutex: %p\n", lock->mutex);
-    return ReleaseMutex(lock->mutex);
+    ReleaseMutex(lock->mutex);
 #else
     LeaveCriticalSection(&lock->crit);
-    return 0;
 #endif
 }
 
@@ -444,10 +442,10 @@ native_cond_timedwait_ms(rb_nativethread https://github.com/ruby/ruby/blob/trunk/thread_win32.c#L442
     return (r == WAIT_OBJECT_0) ? 0 : ETIMEDOUT;
 }
 
-static int
+static void
 native_cond_wait(rb_nativethread_cond_t *cond, rb_nativethread_lock_t *mutex)
 {
-    return native_cond_timedwait_ms(cond, mutex, INFINITE);
+    native_cond_timedwait_ms(cond, mutex, INFINITE);
 }
 
 static unsigned long

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

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