2020-04-10 01:11:40 -04:00
|
|
|
#ifndef RUBY_THREAD_WIN32_H
|
|
|
|
#define RUBY_THREAD_WIN32_H
|
2006-12-31 10:02:22 -05: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-13 17:13:04 -05:00
|
|
|
Copyright (C) 2004-2007 Koichi Sasada
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
/* interface */
|
|
|
|
|
2007-02-07 09:25:03 -05:00
|
|
|
# ifdef __CYGWIN__
|
|
|
|
# undef _WIN32
|
|
|
|
# endif
|
|
|
|
|
2020-11-11 00:37:31 -05:00
|
|
|
#define USE_VM_CLOCK 1
|
|
|
|
|
2006-12-31 10:02:22 -05:00
|
|
|
WINBASEAPI BOOL WINAPI
|
|
|
|
TryEnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
|
|
|
|
|
2010-11-27 15:15:59 -05:00
|
|
|
typedef struct rb_thread_cond_struct {
|
|
|
|
struct cond_event_entry *next;
|
2011-05-07 02:17:59 -04:00
|
|
|
struct cond_event_entry *prev;
|
2013-07-23 06:50:32 -04:00
|
|
|
} rb_nativethread_cond_t;
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
typedef struct native_thread_data_struct {
|
|
|
|
HANDLE interrupt_event;
|
|
|
|
} native_thread_data_t;
|
|
|
|
|
2010-11-27 15:15:59 -05:00
|
|
|
typedef struct rb_global_vm_lock_struct {
|
|
|
|
HANDLE lock;
|
|
|
|
} rb_global_vm_lock_t;
|
|
|
|
|
2020-03-09 13:22:11 -04: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 03:47:32 -04:00
|
|
|
RUBY_SYMBOL_EXPORT_BEGIN
|
|
|
|
RUBY_EXTERN native_tls_key_t ruby_current_ec_key;
|
|
|
|
RUBY_SYMBOL_EXPORT_END
|
|
|
|
|
2007-02-07 09:25:03 -05:00
|
|
|
#endif /* RUBY_THREAD_WIN32_H */
|