* thread_(pthread|win32).h: rename rb_thread_cond_t to

rb_nativethread_cond_t.
* thread.c, thread_pthread.c, thread_win32.c, vm_core.h: catch up
  renaming.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2013-07-23 10:50:32 +00:00
Родитель b2bcef7294
Коммит 4d3feac974
7 изменённых файлов: 40 добавлений и 32 удалений

Просмотреть файл

@ -1,3 +1,11 @@
Tue Jul 23 19:48:38 2013 Koichi Sasada <ko1@atdot.net>
* thread_(pthread|win32).h: rename rb_thread_cond_t to
rb_nativethread_cond_t.
* thread.c, thread_pthread.c, thread_win32.c, vm_core.h: catch up
renaming.
Tue Jul 23 19:44:32 2013 Koichi Sasada <ko1@atdot.net> Tue Jul 23 19:44:32 2013 Koichi Sasada <ko1@atdot.net>
* thread_native.h: add rb_nativethread_self() which returns * thread_native.h: add rb_nativethread_self() which returns

Просмотреть файл

@ -388,7 +388,7 @@ terminate_i(st_data_t key, st_data_t val, rb_thread_t *main_thread)
typedef struct rb_mutex_struct typedef struct rb_mutex_struct
{ {
rb_nativethread_lock_t lock; rb_nativethread_lock_t lock;
rb_thread_cond_t cond; rb_nativethread_cond_t cond;
struct rb_thread_struct volatile *th; struct rb_thread_struct volatile *th;
int cond_waiting; int cond_waiting;
struct rb_mutex_struct *next_mutex; struct rb_mutex_struct *next_mutex;

Просмотреть файл

@ -39,11 +39,11 @@ static void native_mutex_unlock(pthread_mutex_t *lock);
static int native_mutex_trylock(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_initialize(pthread_mutex_t *lock);
static void native_mutex_destroy(pthread_mutex_t *lock); static void native_mutex_destroy(pthread_mutex_t *lock);
static void native_cond_signal(rb_thread_cond_t *cond); static void native_cond_signal(rb_nativethread_cond_t *cond);
static void native_cond_broadcast(rb_thread_cond_t *cond); static void native_cond_broadcast(rb_nativethread_cond_t *cond);
static void native_cond_wait(rb_thread_cond_t *cond, pthread_mutex_t *mutex); static void native_cond_wait(rb_nativethread_cond_t *cond, pthread_mutex_t *mutex);
static void native_cond_initialize(rb_thread_cond_t *cond, int flags); static void native_cond_initialize(rb_nativethread_cond_t *cond, int flags);
static void native_cond_destroy(rb_thread_cond_t *cond); static void native_cond_destroy(rb_nativethread_cond_t *cond);
static void rb_thread_wakeup_timer_thread_low(void); static void rb_thread_wakeup_timer_thread_low(void);
static pthread_t timer_thread_id; static pthread_t timer_thread_id;
@ -253,7 +253,7 @@ native_mutex_destroy(pthread_mutex_t *lock)
} }
static void static void
native_cond_initialize(rb_thread_cond_t *cond, int flags) native_cond_initialize(rb_nativethread_cond_t *cond, int flags)
{ {
#ifdef HAVE_PTHREAD_COND_INIT #ifdef HAVE_PTHREAD_COND_INIT
int r; int r;
@ -284,7 +284,7 @@ native_cond_initialize(rb_thread_cond_t *cond, int flags)
} }
static void static void
native_cond_destroy(rb_thread_cond_t *cond) native_cond_destroy(rb_nativethread_cond_t *cond)
{ {
#ifdef HAVE_PTHREAD_COND_INIT #ifdef HAVE_PTHREAD_COND_INIT
int r = pthread_cond_destroy(&cond->cond); int r = pthread_cond_destroy(&cond->cond);
@ -305,7 +305,7 @@ native_cond_destroy(rb_thread_cond_t *cond)
*/ */
static void static void
native_cond_signal(rb_thread_cond_t *cond) native_cond_signal(rb_nativethread_cond_t *cond)
{ {
int r; int r;
do { do {
@ -317,7 +317,7 @@ native_cond_signal(rb_thread_cond_t *cond)
} }
static void static void
native_cond_broadcast(rb_thread_cond_t *cond) native_cond_broadcast(rb_nativethread_cond_t *cond)
{ {
int r; int r;
do { do {
@ -329,7 +329,7 @@ native_cond_broadcast(rb_thread_cond_t *cond)
} }
static void static void
native_cond_wait(rb_thread_cond_t *cond, pthread_mutex_t *mutex) native_cond_wait(rb_nativethread_cond_t *cond, pthread_mutex_t *mutex)
{ {
int r = pthread_cond_wait(&cond->cond, mutex); int r = pthread_cond_wait(&cond->cond, mutex);
if (r != 0) { if (r != 0) {
@ -338,7 +338,7 @@ native_cond_wait(rb_thread_cond_t *cond, pthread_mutex_t *mutex)
} }
static int static int
native_cond_timedwait(rb_thread_cond_t *cond, pthread_mutex_t *mutex, struct timespec *ts) native_cond_timedwait(rb_nativethread_cond_t *cond, pthread_mutex_t *mutex, struct timespec *ts)
{ {
int r; int r;
@ -360,7 +360,7 @@ native_cond_timedwait(rb_thread_cond_t *cond, pthread_mutex_t *mutex, struct tim
} }
static struct timespec static struct timespec
native_cond_timeout(rb_thread_cond_t *cond, struct timespec timeout_rel) native_cond_timeout(rb_nativethread_cond_t *cond, struct timespec timeout_rel)
{ {
int ret; int ret;
struct timeval tv; struct timeval tv;
@ -764,7 +764,7 @@ thread_start_func_1(void *th_ptr)
struct cached_thread_entry { struct cached_thread_entry {
volatile rb_thread_t **th_area; volatile rb_thread_t **th_area;
rb_thread_cond_t *cond; rb_nativethread_cond_t *cond;
struct cached_thread_entry *next; struct cached_thread_entry *next;
}; };
@ -776,7 +776,7 @@ struct cached_thread_entry *cached_thread_root;
static rb_thread_t * static rb_thread_t *
register_cached_thread_and_wait(void) register_cached_thread_and_wait(void)
{ {
rb_thread_cond_t cond = { PTHREAD_COND_INITIALIZER, }; rb_nativethread_cond_t cond = { PTHREAD_COND_INITIALIZER, };
volatile rb_thread_t *th_area = 0; volatile rb_thread_t *th_area = 0;
struct timeval tv; struct timeval tv;
struct timespec ts; struct timespec ts;
@ -957,7 +957,7 @@ native_sleep(rb_thread_t *th, struct timeval *timeout_tv)
{ {
struct timespec timeout; struct timespec timeout;
pthread_mutex_t *lock = &th->interrupt_lock; pthread_mutex_t *lock = &th->interrupt_lock;
rb_thread_cond_t *cond = &th->native_thread_data.sleep_cond; rb_nativethread_cond_t *cond = &th->native_thread_data.sleep_cond;
if (timeout_tv) { if (timeout_tv) {
struct timespec timeout_rel; struct timespec timeout_rel;
@ -1344,7 +1344,7 @@ void rb_thread_wakeup_timer_thread(void) {}
static void rb_thread_wakeup_timer_thread_low(void) {} static void rb_thread_wakeup_timer_thread_low(void) {}
static pthread_mutex_t timer_thread_lock; static pthread_mutex_t timer_thread_lock;
static rb_thread_cond_t timer_thread_cond; static rb_nativethread_cond_t timer_thread_cond;
static inline void static inline void
timer_thread_sleep(rb_global_vm_lock_t* unused) timer_thread_sleep(rb_global_vm_lock_t* unused)

Просмотреть файл

@ -23,11 +23,11 @@ typedef struct rb_thread_cond_struct {
#ifdef HAVE_CLOCKID_T #ifdef HAVE_CLOCKID_T
clockid_t clockid; clockid_t clockid;
#endif #endif
} rb_thread_cond_t; } rb_nativethread_cond_t;
typedef struct native_thread_data_struct { typedef struct native_thread_data_struct {
void *signal_thread_list; void *signal_thread_list;
rb_thread_cond_t sleep_cond; rb_nativethread_cond_t sleep_cond;
} native_thread_data_t; } native_thread_data_t;
#include <semaphore.h> #include <semaphore.h>
@ -44,11 +44,11 @@ typedef struct rb_global_vm_lock_struct {
/* slow path */ /* slow path */
volatile unsigned long waiting; volatile unsigned long waiting;
rb_thread_cond_t cond; rb_nativethread_cond_t cond;
/* yield */ /* yield */
rb_thread_cond_t switch_cond; rb_nativethread_cond_t switch_cond;
rb_thread_cond_t switch_wait_cond; rb_nativethread_cond_t switch_wait_cond;
int need_yield; int need_yield;
int wait_yield; int wait_yield;
} rb_global_vm_lock_t; } rb_global_vm_lock_t;

Просмотреть файл

@ -401,7 +401,7 @@ struct cond_event_entry {
}; };
static void static void
native_cond_signal(rb_thread_cond_t *cond) native_cond_signal(rb_nativethread_cond_t *cond)
{ {
/* cond is guarded by mutex */ /* cond is guarded by mutex */
struct cond_event_entry *e = cond->next; struct cond_event_entry *e = cond->next;
@ -420,7 +420,7 @@ native_cond_signal(rb_thread_cond_t *cond)
} }
static void static void
native_cond_broadcast(rb_thread_cond_t *cond) native_cond_broadcast(rb_nativethread_cond_t *cond)
{ {
/* cond is guarded by mutex */ /* cond is guarded by mutex */
struct cond_event_entry *e = cond->next; struct cond_event_entry *e = cond->next;
@ -442,7 +442,7 @@ native_cond_broadcast(rb_thread_cond_t *cond)
static int static int
native_cond_timedwait_ms(rb_thread_cond_t *cond, rb_nativethread_lock_t *mutex, unsigned long msec) native_cond_timedwait_ms(rb_nativethread_cond_t *cond, rb_nativethread_lock_t *mutex, unsigned long msec)
{ {
DWORD r; DWORD r;
struct cond_event_entry entry; struct cond_event_entry entry;
@ -473,7 +473,7 @@ native_cond_timedwait_ms(rb_thread_cond_t *cond, rb_nativethread_lock_t *mutex,
} }
static int static int
native_cond_wait(rb_thread_cond_t *cond, rb_nativethread_lock_t *mutex) native_cond_wait(rb_nativethread_cond_t *cond, rb_nativethread_lock_t *mutex)
{ {
return native_cond_timedwait_ms(cond, mutex, INFINITE); return native_cond_timedwait_ms(cond, mutex, INFINITE);
} }
@ -495,7 +495,7 @@ abs_timespec_to_timeout_ms(struct timespec *ts)
} }
static int static int
native_cond_timedwait(rb_thread_cond_t *cond, rb_nativethread_lock_t *mutex, struct timespec *ts) native_cond_timedwait(rb_nativethread_cond_t *cond, rb_nativethread_lock_t *mutex, struct timespec *ts)
{ {
unsigned long timeout_ms; unsigned long timeout_ms;
@ -507,7 +507,7 @@ native_cond_timedwait(rb_thread_cond_t *cond, rb_nativethread_lock_t *mutex, str
} }
static struct timespec static struct timespec
native_cond_timeout(rb_thread_cond_t *cond, struct timespec timeout_rel) native_cond_timeout(rb_nativethread_cond_t *cond, struct timespec timeout_rel)
{ {
int ret; int ret;
struct timeval tv; struct timeval tv;
@ -537,14 +537,14 @@ native_cond_timeout(rb_thread_cond_t *cond, struct timespec timeout_rel)
} }
static void static void
native_cond_initialize(rb_thread_cond_t *cond, int flags) native_cond_initialize(rb_nativethread_cond_t *cond, int flags)
{ {
cond->next = (struct cond_event_entry *)cond; cond->next = (struct cond_event_entry *)cond;
cond->prev = (struct cond_event_entry *)cond; cond->prev = (struct cond_event_entry *)cond;
} }
static void static void
native_cond_destroy(rb_thread_cond_t *cond) native_cond_destroy(rb_nativethread_cond_t *cond)
{ {
/* */ /* */
} }

Просмотреть файл

@ -31,7 +31,7 @@ typedef union rb_thread_lock_union {
typedef struct rb_thread_cond_struct { typedef struct rb_thread_cond_struct {
struct cond_event_entry *next; struct cond_event_entry *next;
struct cond_event_entry *prev; struct cond_event_entry *prev;
} rb_thread_cond_t; } rb_nativethread_cond_t;
typedef struct native_thread_data_struct { typedef struct native_thread_data_struct {
HANDLE interrupt_event; HANDLE interrupt_event;

Просмотреть файл

@ -553,7 +553,7 @@ typedef struct rb_thread_struct {
rb_atomic_t interrupt_flag; rb_atomic_t interrupt_flag;
unsigned long interrupt_mask; unsigned long interrupt_mask;
rb_nativethread_lock_t interrupt_lock; rb_nativethread_lock_t interrupt_lock;
rb_thread_cond_t interrupt_cond; rb_nativethread_cond_t interrupt_cond;
struct rb_unblock_callback unblock; struct rb_unblock_callback unblock;
VALUE locking_mutex; VALUE locking_mutex;
struct rb_mutex_struct *keeping_mutexes; struct rb_mutex_struct *keeping_mutexes;