Permalink
Browse files

* thread_pthread.c, thread_pthread.h, thread_win32.c,

  thread_win32.c: make some functions static functions.
  a patch from Tadashi Saito <shiba AT mail2.accsnet.ne.jp>
  in [ruby-core:14407]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent f394561 commit 42f0b52f771570adebbea518fa2464bd227bca99 @ko1 ko1 committed Dec 25, 2007
Showing with 51 additions and 44 deletions.
  1. +7 −0 ChangeLog
  2. +23 −10 thread_pthread.c
  3. +0 −13 thread_pthread.h
  4. +21 −10 thread_win32.c
  5. +0 −11 thread_win32.h
View
@@ -1,3 +1,10 @@
+Tue Dec 25 13:30:03 2007 Koichi Sasada <ko1@atdot.net>
+
+ * thread_pthread.c, thread_pthread.h, thread_win32.c,
+ thread_win32.c: make some functions static functions.
+ a patch from Tadashi Saito <shiba AT mail2.accsnet.ne.jp>
+ in [ruby-core:14407]
+
Tue Dec 25 13:23:13 2007 Tanaka Akira <akr@fsij.org>
* test/ruby/test_io_m17n.rb (test_write_noenc): don't mix text and
View
@@ -12,7 +12,20 @@
#ifdef THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION
-void
+static void native_mutex_lock(pthread_mutex_t *lock);
+static void native_mutex_unlock(pthread_mutex_t *lock);
+static void native_mutex_destroy(pthread_mutex_t *lock);
+static int native_mutex_trylock(pthread_mutex_t *lock);
+static void native_mutex_initialize(pthread_mutex_t *lock);
+static void native_mutex_destroy(pthread_mutex_t *lock);
+
+static void native_cond_signal(pthread_cond_t *cond);
+static void native_cond_broadcast(pthread_cond_t *cond);
+static void native_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
+static void native_cond_initialize(pthread_cond_t *cond);
+static void native_cond_destroy(pthread_cond_t *cond);
+
+static void
native_mutex_lock(pthread_mutex_t *lock)
{
int r;
@@ -21,7 +34,7 @@ native_mutex_lock(pthread_mutex_t *lock)
}
}
-void
+static void
native_mutex_unlock(pthread_mutex_t *lock)
{
int r;
@@ -30,7 +43,7 @@ native_mutex_unlock(pthread_mutex_t *lock)
}
}
-inline int
+static inline int
native_mutex_trylock(pthread_mutex_t *lock)
{
int r;
@@ -45,7 +58,7 @@ native_mutex_trylock(pthread_mutex_t *lock)
return 0;
}
-void
+static void
native_mutex_initialize(pthread_mutex_t *lock)
{
int r = pthread_mutex_init(lock, 0);
@@ -54,7 +67,7 @@ native_mutex_initialize(pthread_mutex_t *lock)
}
}
-void
+static void
native_mutex_destroy(pthread_mutex_t *lock)
{
int r = pthread_mutex_destroy(lock);
@@ -63,7 +76,7 @@ native_mutex_destroy(pthread_mutex_t *lock)
}
}
-void
+static void
native_cond_initialize(pthread_cond_t *cond)
{
int r = pthread_cond_init(cond, 0);
@@ -72,7 +85,7 @@ native_cond_initialize(pthread_cond_t *cond)
}
}
-void
+static void
native_cond_destroy(pthread_cond_t *cond)
{
int r = pthread_cond_destroy(cond);
@@ -81,19 +94,19 @@ native_cond_destroy(pthread_cond_t *cond)
}
}
-void
+static void
native_cond_signal(pthread_cond_t *cond)
{
pthread_cond_signal(cond);
}
-void
+static void
native_cond_broadcast(pthread_cond_t *cond)
{
pthread_cond_broadcast(cond);
}
-void
+static void
native_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
{
pthread_cond_wait(cond, mutex);
View
@@ -17,19 +17,6 @@ typedef pthread_t rb_thread_id_t;
typedef pthread_mutex_t rb_thread_lock_t;
typedef pthread_cond_t rb_thread_cond_t;
-void native_mutex_lock(pthread_mutex_t *lock);
-void native_mutex_unlock(pthread_mutex_t *lock);
-void native_mutex_destroy(pthread_mutex_t *lock);
-int native_mutex_trylock(pthread_mutex_t *lock);
-void native_mutex_initialize(pthread_mutex_t *lock);
-void native_mutex_destroy(pthread_mutex_t *lock);
-
-void native_cond_signal(pthread_cond_t *cond);
-void native_cond_broadcast(pthread_cond_t *cond);
-void native_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
-void native_cond_initialize(pthread_cond_t *cond);
-void native_cond_destroy(pthread_cond_t *cond);
-
typedef struct native_thread_data_struct {
void *signal_thread_list;
pthread_cond_t sleep_cond;
View
@@ -22,6 +22,17 @@
static volatile DWORD ruby_native_thread_key = TLS_OUT_OF_INDEXES;
+static int native_mutex_lock(rb_thread_lock_t *);
+static int native_mutex_unlock(rb_thread_lock_t *);
+static int native_mutex_trylock(rb_thread_lock_t *);
+static void native_mutex_initialize(rb_thread_lock_t *);
+
+static void native_cond_signal(rb_thread_cond_t *cond);
+static void native_cond_broadcast(rb_thread_cond_t *cond);
+static void native_cond_wait(rb_thread_cond_t *cond, rb_thread_lock_t *mutex);
+static void native_cond_initialize(rb_thread_cond_t *cond);
+static void native_cond_destroy(rb_thread_cond_t *cond);
+
static rb_thread_t *
ruby_thread_from_native(void)
{
@@ -230,7 +241,7 @@ native_sleep(rb_thread_t *th, struct timeval *tv)
RUBY_VM_CHECK_INTS();
}
-int
+static int
native_mutex_lock(rb_thread_lock_t *lock)
{
#if USE_WIN32_MUTEX
@@ -266,7 +277,7 @@ native_mutex_lock(rb_thread_lock_t *lock)
#endif
}
-int
+static int
native_mutex_unlock(rb_thread_lock_t *lock)
{
#if USE_WIN32_MUTEX
@@ -278,7 +289,7 @@ native_mutex_unlock(rb_thread_lock_t *lock)
#endif
}
-int
+static int
native_mutex_trylock(rb_thread_lock_t *lock)
{
#if USE_WIN32_MUTEX
@@ -298,7 +309,7 @@ native_mutex_trylock(rb_thread_lock_t *lock)
#endif
}
-void
+static void
native_mutex_initialize(rb_thread_lock_t *lock)
{
#if USE_WIN32_MUTEX
@@ -312,7 +323,7 @@ native_mutex_initialize(rb_thread_lock_t *lock)
#endif
}
-void
+static void
native_mutex_destroy(rb_thread_lock_t *lock)
{
#if USE_WIN32_MUTEX
@@ -332,7 +343,7 @@ struct rb_thread_cond_struct {
struct cond_event_entry *last;
};
-void
+static void
native_cond_signal(rb_thread_cond_t *cond)
{
/* cond is guarded by mutex */
@@ -347,7 +358,7 @@ native_cond_signal(rb_thread_cond_t *cond)
}
}
-void
+static void
native_cond_broadcast(rb_thread_cond_t *cond)
{
/* cond is guarded by mutex */
@@ -360,7 +371,7 @@ native_cond_broadcast(rb_thread_cond_t *cond)
}
}
-void
+static void
native_cond_wait(rb_thread_cond_t *cond, rb_thread_lock_t *mutex)
{
DWORD r;
@@ -391,14 +402,14 @@ native_cond_wait(rb_thread_cond_t *cond, rb_thread_lock_t *mutex)
w32_close_handle(entry.event);
}
-void
+static void
native_cond_initialize(rb_thread_cond_t *cond)
{
cond->next = 0;
cond->last = 0;
}
-void
+static void
native_cond_destroy(rb_thread_cond_t *cond)
{
/* */
View
@@ -26,17 +26,6 @@ typedef HANDLE rb_thread_id_t;
typedef CRITICAL_SECTION rb_thread_lock_t;
typedef struct rb_thread_cond_struct rb_thread_cond_t;
-int native_mutex_lock(rb_thread_lock_t *);
-int native_mutex_unlock(rb_thread_lock_t *);
-int native_mutex_trylock(rb_thread_lock_t *);
-void native_mutex_initialize(rb_thread_lock_t *);
-
-void native_cond_signal(rb_thread_cond_t *cond);
-void native_cond_broadcast(rb_thread_cond_t *cond);
-void native_cond_wait(rb_thread_cond_t *cond, rb_thread_lock_t *mutex);
-void native_cond_initialize(rb_thread_cond_t *cond);
-void native_cond_destroy(rb_thread_cond_t *cond);
-
typedef struct native_thread_data_struct {
HANDLE interrupt_event;
} native_thread_data_t;

0 comments on commit 42f0b52

Please sign in to comment.