2020-04-10 08:11:40 +03:00
|
|
|
#ifndef RUBY_THREAD_WIN32_H
|
|
|
|
#define RUBY_THREAD_WIN32_H
|
2006-12-31 18:02:22 +03:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
thread_win32.h -
|
|
|
|
|
|
|
|
$Author$
|
|
|
|
|
* blockinlining.c, compile.c, compile.h, debug.c, debug.h,
id.c, insnhelper.h, insns.def, thread.c, thread_pthread.ci,
thread_pthread.h, thread_win32.ci, thread_win32.h, vm.h,
vm_dump.c, vm_evalbody.ci, vm_opts.h: fix comments and
copyright year.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-14 01:13:04 +03:00
|
|
|
Copyright (C) 2004-2007 Koichi Sasada
|
2006-12-31 18:02:22 +03:00
|
|
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
/* interface */
|
|
|
|
|
2007-02-07 17:25:03 +03:00
|
|
|
# ifdef __CYGWIN__
|
|
|
|
# undef _WIN32
|
|
|
|
# endif
|
|
|
|
|
2020-11-11 08:37:31 +03:00
|
|
|
#define USE_VM_CLOCK 1
|
|
|
|
|
2006-12-31 18:02:22 +03:00
|
|
|
WINBASEAPI BOOL WINAPI
|
|
|
|
TryEnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
|
|
|
|
|
2021-09-03 14:27:58 +03:00
|
|
|
struct rb_thread_cond_struct {
|
2010-11-27 23:15:59 +03:00
|
|
|
struct cond_event_entry *next;
|
2011-05-07 10:17:59 +04:00
|
|
|
struct cond_event_entry *prev;
|
2021-09-03 14:27:58 +03:00
|
|
|
};
|
2006-12-31 18:02:22 +03:00
|
|
|
|
|
|
|
typedef struct native_thread_data_struct {
|
|
|
|
HANDLE interrupt_event;
|
|
|
|
} native_thread_data_t;
|
|
|
|
|
2010-11-27 23:15:59 +03:00
|
|
|
typedef struct rb_global_vm_lock_struct {
|
|
|
|
HANDLE lock;
|
|
|
|
} rb_global_vm_lock_t;
|
|
|
|
|
2020-03-09 20:22:11 +03:00
|
|
|
typedef DWORD native_tls_key_t; // TLS index
|
|
|
|
|
|
|
|
static inline void *
|
|
|
|
native_tls_get(native_tls_key_t key)
|
|
|
|
{
|
|
|
|
void *ptr = TlsGetValue(key);
|
|
|
|
if (UNLIKELY(ptr == NULL)) {
|
|
|
|
rb_bug("TlsGetValue() returns NULL");
|
|
|
|
}
|
|
|
|
return ptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
native_tls_set(native_tls_key_t key, void *ptr)
|
|
|
|
{
|
|
|
|
if (UNLIKELY(TlsSetValue(key, ptr) == 0)) {
|
|
|
|
rb_bug("TlsSetValue() error");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-19 10:47:32 +03:00
|
|
|
RUBY_SYMBOL_EXPORT_BEGIN
|
|
|
|
RUBY_EXTERN native_tls_key_t ruby_current_ec_key;
|
|
|
|
RUBY_SYMBOL_EXPORT_END
|
|
|
|
|
2007-02-07 17:25:03 +03:00
|
|
|
#endif /* RUBY_THREAD_WIN32_H */
|