Ruby 4.1.0dev (2026-09-07 revision b57404b461ba8bf34e802d86b0db78388216e182)
thread_win32.h (b57404b461ba8bf34e802d86b0db78388216e182)
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 This platform runs the common scheduler; see thread_sched.h for its data
12 structures and thread_sched.c for the implementation.
13
14**********************************************************************/
15
16/* interface */
17
18# ifdef __CYGWIN__
19# undef _WIN32
20# endif
21
22WINBASEAPI BOOL WINAPI
23TryEnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
24
25#include "thread_sched.h"
26
27typedef DWORD native_tls_key_t; // TLS index
28
29static inline void *
30native_tls_get(native_tls_key_t key)
31{
32 // return value should be checked by caller.
33 return TlsGetValue(key);
34}
35
36static inline void
37native_tls_set(native_tls_key_t key, void *ptr)
38{
39 if (UNLIKELY(TlsSetValue(key, ptr) == 0)) {
40 rb_bug("TlsSetValue() error");
41 }
42}
43
44RUBY_SYMBOL_EXPORT_BEGIN
45RUBY_EXTERN native_tls_key_t ruby_current_ec_key;
46RUBY_SYMBOL_EXPORT_END
47
48#endif /* RUBY_THREAD_WIN32_H */
#define RUBY_EXTERN
Declaration of externally visible global variables.
Definition dllexport.h:45