Ruby  2.7.2p137(2020-10-01revision5445e0435260b449decf2ac16f9d09bae3cafe72)
thread_native.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  thread_native.h -
4 
5  $Author: ko1 $
6  created at: Wed May 14 19:37:31 2014
7 
8  Copyright (C) 2014 Yukihiro Matsumoto
9 
10 **********************************************************************/
11 
12 #ifndef RUBY_THREAD_NATIVE_H
13 #define RUBY_THREAD_NATIVE_H 1
14 
15 /*
16  * This file contains wrapper APIs for native thread primitives
17  * which Ruby interpreter uses.
18  *
19  * Now, we only suppors pthread and Windows threads.
20  *
21  * If you want to use Ruby's Mutex and so on to synchronize Ruby Threads,
22  * please use Mutex directly.
23  */
24 
25 
26 #if defined(_WIN32)
27 #include <windows.h>
28 typedef HANDLE rb_nativethread_id_t;
29 
30 typedef union rb_thread_lock_union {
31  HANDLE mutex;
32  CRITICAL_SECTION crit;
34 
35 #elif defined(HAVE_PTHREAD_H)
36 #include <pthread.h>
39 
40 #else
41 #error "unsupported thread type"
42 
43 #endif
44 
46 
48 
53 
55 
56 #endif
RUBY_SYMBOL_EXPORT_END
#define RUBY_SYMBOL_EXPORT_END
Definition: missing.h:49
rb_nativethread_lock_unlock
void rb_nativethread_lock_unlock(rb_nativethread_lock_t *lock)
Definition: thread.c:451
rb_nativethread_self
RUBY_SYMBOL_EXPORT_BEGIN rb_nativethread_id_t rb_nativethread_self()
rb_nativethread_id_t
pthread_t rb_nativethread_id_t
Definition: rb_mjit_min_header-2.7.2.h:9391
rb_nativethread_lock_lock
void rb_nativethread_lock_lock(rb_nativethread_lock_t *lock)
Definition: thread.c:445
rb_nativethread_lock_destroy
void rb_nativethread_lock_destroy(rb_nativethread_lock_t *lock)
Definition: thread.c:439
rb_nativethread_lock_initialize
void rb_nativethread_lock_initialize(rb_nativethread_lock_t *lock)
Definition: thread.c:433
crit
int crit
Definition: rb_mjit_min_header-2.7.2.h:12294
__pthread_mutex_t
Definition: rb_mjit_min_header-2.7.2.h:1383
rb_nativethread_lock_t
pthread_mutex_t rb_nativethread_lock_t
Definition: rb_mjit_min_header-2.7.2.h:9392
RUBY_SYMBOL_EXPORT_BEGIN
#define RUBY_SYMBOL_EXPORT_BEGIN
Definition: missing.h:48
__pthread_t
Definition: rb_mjit_min_header-2.7.2.h:1382