Skip to content
Newer
Older
100644 57 lines (42 sloc) 1.14 KB
a3e1b1c @ko1 * Merge YARV
ko1 authored
1 /**********************************************************************
2
3 thread_pthread.h -
4
5 $Author$
6
d907cbc @ko1 * blockinlining.c, compile.c, compile.h, debug.c, debug.h,
ko1 authored
7 Copyright (C) 2004-2007 Koichi Sasada
a3e1b1c @ko1 * Merge YARV
ko1 authored
8
9 **********************************************************************/
10
8a9993d @nobu * eval_intern.h, insnhelper.h, thread_pthread.h, vm_core.h, vm_opts.h:
nobu authored
11 #ifndef RUBY_THREAD_PTHREAD_H
12 #define RUBY_THREAD_PTHREAD_H
a3e1b1c @ko1 * Merge YARV
ko1 authored
13
14 #include <pthread.h>
b323b86 @nurse * thread_pthread.c (native_thread_init_stack): use get_stack.
nurse authored
15 #ifdef HAVE_PTHREAD_NP_H
16 #include <pthread_np.h>
17 #endif
8ee7d07 @ko1 * blockinlining.c, compile.c, compile.h, error.c, eval.c,
ko1 authored
18 typedef pthread_t rb_thread_id_t;
19 typedef pthread_mutex_t rb_thread_lock_t;
a1cfaf4 @kosaki * thread_pthread.h (rb_thread_cond_t): add clockid field. it's
kosaki authored
20
21 typedef struct rb_thread_cond_struct {
22 pthread_cond_t cond;
1bd2c78 @nobu * thread_pthread.c (USE_MONOTONIC_COND): check the availability
nobu authored
23 #ifdef HAVE_CLOCKID_T
a1cfaf4 @kosaki * thread_pthread.h (rb_thread_cond_t): add clockid field. it's
kosaki authored
24 clockid_t clockid;
1bd2c78 @nobu * thread_pthread.c (USE_MONOTONIC_COND): check the availability
nobu authored
25 #endif
a1cfaf4 @kosaki * thread_pthread.h (rb_thread_cond_t): add clockid field. it's
kosaki authored
26 } rb_thread_cond_t;
a3e1b1c @ko1 * Merge YARV
ko1 authored
27
28 typedef struct native_thread_data_struct {
29 void *signal_thread_list;
a1cfaf4 @kosaki * thread_pthread.h (rb_thread_cond_t): add clockid field. it's
kosaki authored
30 rb_thread_cond_t sleep_cond;
a3e1b1c @ko1 * Merge YARV
ko1 authored
31 } native_thread_data_t;
32
450463d @ko1 * thread.c, vm_core.h: make gvl_acquire/release/init/destruct
ko1 authored
33 #include <semaphore.h>
34
2fd8753 @nobu * thread_pthread.h: no Structured Exception Handling like macros.
nobu authored
35 #undef except
36 #undef try
37 #undef leave
38 #undef finally
39
450463d @ko1 * thread.c, vm_core.h: make gvl_acquire/release/init/destruct
ko1 authored
40 typedef struct rb_global_vm_lock_struct {
bcfc22b @kosaki * thread_pthread.c: rewrite GVL completely.
kosaki authored
41 /* fast path */
42 unsigned long acquired;
450463d @ko1 * thread.c, vm_core.h: make gvl_acquire/release/init/destruct
ko1 authored
43 pthread_mutex_t lock;
bcfc22b @kosaki * thread_pthread.c: rewrite GVL completely.
kosaki authored
44
45 /* slow path */
d647b53 @kosaki * thread_pthread.h (rb_global_vm_lock_struct): add volatile to
kosaki authored
46 volatile unsigned long waiting;
bcfc22b @kosaki * thread_pthread.c: rewrite GVL completely.
kosaki authored
47 rb_thread_cond_t cond;
48
49 /* yield */
50 rb_thread_cond_t switch_cond;
82e6d95 @kosaki * thread_pthread.c (gvl_yield): fix live lock issue on 1-2 cpus
kosaki authored
51 rb_thread_cond_t switch_wait_cond;
52 int need_yield;
53 int wait_yield;
450463d @ko1 * thread.c, vm_core.h: make gvl_acquire/release/init/destruct
ko1 authored
54 } rb_global_vm_lock_t;
55
8a9993d @nobu * eval_intern.h, insnhelper.h, thread_pthread.h, vm_core.h, vm_opts.h:
nobu authored
56 #endif /* RUBY_THREAD_PTHREAD_H */
Something went wrong with that request. Please try again.