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);
|
|
|
|
|
2021-09-03 07:27:58 -04:00
|
|
|
struct rb_thread_cond_struct {
|
2010-11-27 15:15:59 -05:00
|
|
|
struct cond_event_entry *next;
|
2011-05-07 02:17:59 -04:00
|
|
|
struct cond_event_entry *prev;
|
2021-09-03 07:27:58 -04:00
|
|
|
};
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2022-04-22 08:19:03 -04:00
|
|
|
struct rb_native_thread {
|
|
|
|
HANDLE thread_id;
|
2006-12-31 10:02:22 -05:00
|
|
|
HANDLE interrupt_event;
|
2022-04-22 08:19:03 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct rb_thread_sched_item {
|
|
|
|
char dmy;
|
|
|
|
};
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2022-04-16 14:40:23 -04:00
|
|
|
struct rb_thread_sched {
|
2010-11-27 15:15:59 -05:00
|
|
|
HANDLE lock;
|
2022-04-16 14:40:23 -04:00
|
|
|
};
|
2010-11-27 15:15:59 -05:00
|
|
|
|
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)
|
|
|
|
{
|
2022-05-23 15:54:26 -04:00
|
|
|
// return value should be checked by caller.
|
|
|
|
return TlsGetValue(key);
|
2020-03-09 13:22:11 -04: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 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 */
|