Ruby: thread_win32.h Source File

Ruby 3.2.5p208 (2024-07-26 revision 31d0f1a2e7dbfb60731d1f05b868e1d578cda493)

thread_win32.h
1#ifndef RUBY_THREAD_WIN32_H
2#define RUBY_THREAD_WIN32_H
3/**********************************************************************
4
5 thread_win32.h -
6
7 $Author$
8
9 Copyright (C) 2004-2007 Koichi Sasada
10
11**********************************************************************/
12
13/* interface */
14
15# ifdef __CYGWIN__
16# undef _WIN32
17# endif
18
19#define USE_VM_CLOCK 1
20
21WINBASEAPI BOOL WINAPI
22TryEnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
23
24 struct rb_thread_cond_struct {
25 struct cond_event_entry *next;
26 struct cond_event_entry *prev;
27};
28
29struct rb_native_thread {
30 HANDLE thread_id;
31 HANDLE interrupt_event;
32};
33
34struct rb_thread_sched_item {
35 char dmy;
36};
37
38struct rb_thread_sched {
39 HANDLE lock;
40};
41
42typedef DWORD native_tls_key_t; // TLS index
43
44static inline void *
45native_tls_get(native_tls_key_t key)
46{
47 // return value should be checked by caller.
48 return TlsGetValue(key);
49}
50
51static inline void
52native_tls_set(native_tls_key_t key, void *ptr)
53{
54 if (UNLIKELY(TlsSetValue(key, ptr) == 0)) {
55 rb_bug("TlsSetValue() error");
56 }
57}
58
59RUBY_SYMBOL_EXPORT_BEGIN
60 RUBY_EXTERN native_tls_key_t ruby_current_ec_key;
61RUBY_SYMBOL_EXPORT_END
62
63#endif /* RUBY_THREAD_WIN32_H */
RUBY_EXTERN
#define RUBY_EXTERN
Declaration of externally visible global variables.
Definition dllexport.h:47
rb_bug
void rb_bug(const char *fmt,...)
Interpreter panic switch.
Definition error.c:794
rb_native_thread
Definition thread_none.h:11
rb_thread_cond_struct
Definition thread_win32.h:24
rb_thread_sched_item
Definition thread_none.h:15
rb_thread_sched
Definition thread_none.h:16