Ruby 2.0.0p353(2013-11-22revision43784)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

thread_pthread.h
Go to the documentation of this file.
1 /**********************************************************************
2
3 thread_pthread.h -
4
5 $Author: nobu $
6
7 Copyright (C) 2004-2007 Koichi Sasada
8
9 **********************************************************************/
10
11 #ifndef RUBY_THREAD_PTHREAD_H
12 #define RUBY_THREAD_PTHREAD_H
13
14 #include <pthread.h>
15 #ifdef HAVE_PTHREAD_NP_H
16 #include <pthread_np.h>
17 #endif
18 typedef pthread_t rb_thread_id_t;
19 typedef pthread_mutex_t rb_thread_lock_t;
20
21 typedef struct rb_thread_cond_struct {
22 pthread_cond_t cond;
23 #ifdef HAVE_CLOCKID_T
24 clockid_t clockid;
25 #endif
26 } rb_thread_cond_t;
27
28 typedef struct native_thread_data_struct {
29 void *signal_thread_list;
30 rb_thread_cond_t sleep_cond;
31 } native_thread_data_t;
32
33 #include <semaphore.h>
34
35 #undef except
36 #undef try
37 #undef leave
38 #undef finally
39
40 typedef struct rb_global_vm_lock_struct {
41 /* fast path */
42 unsigned long acquired;
43 pthread_mutex_t lock;
44
45 /* slow path */
46 volatile unsigned long waiting;
47 rb_thread_cond_t cond;
48
49 /* yield */
50 rb_thread_cond_t switch_cond;
51 rb_thread_cond_t switch_wait_cond;
52 int need_yield;
53 int wait_yield;
54 } rb_global_vm_lock_t;
55
56 #endif /* RUBY_THREAD_PTHREAD_H */
rb_global_vm_lock_struct::wait_yield
int wait_yield
Definition: thread_pthread.h:53
rb_global_vm_lock_struct::waiting
volatile unsigned long waiting
Definition: thread_pthread.h:46
native_thread_data_struct::signal_thread_list
void * signal_thread_list
Definition: thread_pthread.h:29
rb_thread_lock_t
pthread_mutex_t rb_thread_lock_t
Definition: thread_pthread.h:19
rb_global_vm_lock_struct::switch_cond
rb_thread_cond_t switch_cond
Definition: thread_pthread.h:50
rb_thread_cond_t
struct rb_thread_cond_struct rb_thread_cond_t
native_thread_data_struct
Definition: thread_pthread.h:28
rb_thread_id_t
pthread_t rb_thread_id_t
Definition: thread_pthread.h:18
native_thread_data_t
struct native_thread_data_struct native_thread_data_t
rb_global_vm_lock_struct::cond
rb_thread_cond_t cond
Definition: thread_pthread.h:47
rb_global_vm_lock_struct::switch_wait_cond
rb_thread_cond_t switch_wait_cond
Definition: thread_pthread.h:51
rb_thread_cond_struct
Definition: thread_pthread.h:21
native_thread_data_struct::sleep_cond
rb_thread_cond_t sleep_cond
Definition: thread_pthread.h:30
rb_thread_cond_struct::cond
pthread_cond_t cond
Definition: thread_pthread.h:22
rb_global_vm_lock_struct::acquired
unsigned long acquired
Definition: thread_pthread.h:42
rb_global_vm_lock_struct::need_yield
int need_yield
Definition: thread_pthread.h:52
rb_global_vm_lock_struct::lock
pthread_mutex_t lock
Definition: thread_pthread.h:43
rb_global_vm_lock_t
struct rb_global_vm_lock_struct rb_global_vm_lock_t
rb_global_vm_lock_struct
Definition: thread_pthread.h:40