Fix typos [ci skip]
[ruby-80x24.org.git] / thread_win32.h
blob994949d2b4c015a91f59bcc652800033001a0612
1 #ifndef RUBY_THREAD_WIN32_H
2 #define RUBY_THREAD_WIN32_H
3 /**********************************************************************
5 thread_win32.h -
7 $Author$
9 Copyright (C) 2004-2007 Koichi Sasada
11 **********************************************************************/
13 /* interface */
15 # ifdef __CYGWIN__
16 # undef _WIN32
17 # endif
19 #define USE_VM_CLOCK 1
21 WINBASEAPI BOOL WINAPI
22 TryEnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
24 struct rb_thread_cond_struct {
25 struct cond_event_entry *next;
26 struct cond_event_entry *prev;
29 typedef struct native_thread_data_struct {
30 HANDLE interrupt_event;
31 } native_thread_data_t;
33 typedef struct rb_global_vm_lock_struct {
34 HANDLE lock;
35 } rb_global_vm_lock_t;
37 typedef DWORD native_tls_key_t; // TLS index
39 static inline void *
40 native_tls_get(native_tls_key_t key)
42 void *ptr = TlsGetValue(key);
43 if (UNLIKELY(ptr == NULL)) {
44 rb_bug("TlsGetValue() returns NULL");
46 return ptr;
49 static inline void
50 native_tls_set(native_tls_key_t key, void *ptr)
52 if (UNLIKELY(TlsSetValue(key, ptr) == 0)) {
53 rb_bug("TlsSetValue() error");
57 RUBY_SYMBOL_EXPORT_BEGIN
58 RUBY_EXTERN native_tls_key_t ruby_current_ec_key;
59 RUBY_SYMBOL_EXPORT_END
61 #endif /* RUBY_THREAD_WIN32_H */