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);
|
|
|
|
|
2022-04-22 15:19:03 +03:00
|
|
|
struct rb_native_thread {
|
|
|
|
HANDLE thread_id;
|
2006-12-31 18:02:22 +03:00
|
|
|
HANDLE interrupt_event;
|
2022-04-22 15:19:03 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct rb_thread_sched_item {
|
2023-04-10 04:53:13 +03:00
|
|
|
void *vm_stack;
|
2022-04-22 15:19:03 +03:00
|
|
|
};
|
2006-12-31 18:02:22 +03:00
|
|
|
|
2022-04-16 21:40:23 +03:00
|
|
|
struct rb_thread_sched {
|
2010-11-27 23:15:59 +03:00
|
|
|
HANDLE lock;
|
2022-04-16 21:40:23 +03:00
|
|
|
};
|
2010-11-27 23:15:59 +03:00
|
|
|
|
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)
|
|
|
|
{
|
2022-05-23 22:54:26 +03:00
|
|
|
// return value should be checked by caller.
|
|
|
|
return TlsGetValue(key);
|
2020-03-09 20:22:11 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
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 */
|