Ruby
2.7.1p83(2020-03-31revisiona0c7c23c9cec0d0ffcba012279cd652d28ad5bf3)
include
ruby
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
;
33
}
rb_nativethread_lock_t
;
34
35
#elif defined(HAVE_PTHREAD_H)
36
#include <pthread.h>
37
typedef
pthread_t
rb_nativethread_id_t
;
38
typedef
pthread_mutex_t
rb_nativethread_lock_t
;
39
40
#else
41
#error "unsupported thread type"
42
43
#endif
44
45
RUBY_SYMBOL_EXPORT_BEGIN
46
47
rb_nativethread_id_t
rb_nativethread_self
();
48
49
void
rb_nativethread_lock_initialize
(
rb_nativethread_lock_t
*lock);
50
void
rb_nativethread_lock_destroy
(
rb_nativethread_lock_t
*lock);
51
void
rb_nativethread_lock_lock
(
rb_nativethread_lock_t
*lock);
52
void
rb_nativethread_lock_unlock
(
rb_nativethread_lock_t
*lock);
53
54
RUBY_SYMBOL_EXPORT_END
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.1.h:9348
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
rb_nativethread_lock_t
pthread_mutex_t rb_nativethread_lock_t
Definition:
rb_mjit_min_header-2.7.1.h:9349
__pthread_mutex_t
Definition:
rb_mjit_min_header-2.7.1.h:1346
RUBY_SYMBOL_EXPORT_BEGIN
#define RUBY_SYMBOL_EXPORT_BEGIN
Definition:
missing.h:48
__pthread_t
Definition:
rb_mjit_min_header-2.7.1.h:1345
crit
int crit
Definition:
rb_mjit_min_header-2.7.1.h:12251
Generated by
1.8.17