Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 783 lines (657 sloc) 17.606 kB
a3e1b1c @ko1 * Merge YARV
ko1 authored
1 /* -*-c-*- */
2 /**********************************************************************
3
c334a09 @ko1 * common.mk, *.ci: renamed to *.c.
ko1 authored
4 thread_win32.c -
a3e1b1c @ko1 * Merge YARV
ko1 authored
5
6 $Author$
7
d907cbc @ko1 * blockinlining.c, compile.c, compile.h, debug.c, debug.h,
ko1 authored
8 Copyright (C) 2004-2007 Koichi Sasada
a3e1b1c @ko1 * Merge YARV
ko1 authored
9
10 **********************************************************************/
11
12 #ifdef THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION
13
14 #include <process.h>
15
bcfc22b @kosaki * thread_pthread.c: rewrite GVL completely.
kosaki authored
16 #define TIME_QUANTUM_USEC (100 * 1000)
604a1e2 @kosaki fix win32 compile error.
kosaki authored
17 #define RB_CONDATTR_CLOCK_MONOTONIC 1 /* no effect */
18
a3e1b1c @ko1 * Merge YARV
ko1 authored
19 #undef Sleep
20
21 #define native_thread_yield() Sleep(0)
ae317b5 @ko1 * yarvcore.h, thread.c: fix to use pthread on cygwin.
ko1 authored
22 #define remove_signal_thread_list(th)
a3e1b1c @ko1 * Merge YARV
ko1 authored
23
6fc746d @nobu * thread.c (is_ruby_native_thread): check properly. [ruby-dev:31166]
nobu authored
24 static volatile DWORD ruby_native_thread_key = TLS_OUT_OF_INDEXES;
25
5f131b6 @nobu * thread_win32.c, include/ruby/win32.h: add prototypes.
nobu authored
26 static int w32_wait_events(HANDLE *events, int count, DWORD timeout, rb_thread_t *th);
27 static int native_mutex_lock(rb_thread_lock_t *lock);
28 static int native_mutex_unlock(rb_thread_lock_t *lock);
29
450463d @ko1 * thread.c, vm_core.h: make gvl_acquire/release/init/destruct
ko1 authored
30 static void
31 w32_error(const char *func)
32 {
33 LPVOID lpMsgBuf;
34 DWORD err = GetLastError();
35 if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
36 FORMAT_MESSAGE_FROM_SYSTEM |
37 FORMAT_MESSAGE_IGNORE_INSERTS,
38 NULL,
39 err,
40 MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
41 (LPTSTR) & lpMsgBuf, 0, NULL) == 0)
42 FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
43 FORMAT_MESSAGE_FROM_SYSTEM |
44 FORMAT_MESSAGE_IGNORE_INSERTS,
45 NULL,
46 err,
47 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
48 (LPTSTR) & lpMsgBuf, 0, NULL);
49 rb_bug("%s: %s", func, (char*)lpMsgBuf);
50 }
51
52 static int
53 w32_mutex_lock(HANDLE lock)
54 {
55 DWORD result;
56 while (1) {
57 thread_debug("native_mutex_lock: %p\n", lock);
58 result = w32_wait_events(&lock, 1, INFINITE, 0);
59 switch (result) {
60 case WAIT_OBJECT_0:
61 /* get mutex object */
62 thread_debug("acquire mutex: %p\n", lock);
63 return 0;
64 case WAIT_OBJECT_0 + 1:
65 /* interrupt */
66 errno = EINTR;
67 thread_debug("acquire mutex interrupted: %p\n", lock);
68 return 0;
69 case WAIT_TIMEOUT:
70 thread_debug("timeout mutex: %p\n", lock);
71 break;
72 case WAIT_ABANDONED:
73 rb_bug("win32_mutex_lock: WAIT_ABANDONED");
74 break;
75 default:
f0445d1 @nobu * thread_win32.c (gvl_release, gvl_init): suppress warnings.
nobu authored
76 rb_bug("win32_mutex_lock: unknown result (%ld)", result);
450463d @ko1 * thread.c, vm_core.h: make gvl_acquire/release/init/destruct
ko1 authored
77 break;
78 }
79 }
80 return 0;
81 }
82
83 static HANDLE
84 w32_mutex_create(void)
85 {
86 HANDLE lock = CreateMutex(NULL, FALSE, NULL);
87 if (lock == NULL) {
88 w32_error("native_mutex_initialize");
89 }
90 return lock;
91 }
92
93 #define GVL_DEBUG 0
94
95 static void
96 gvl_acquire(rb_vm_t *vm, rb_thread_t *th)
97 {
98 w32_mutex_lock(vm->gvl.lock);
99 if (GVL_DEBUG) fprintf(stderr, "gvl acquire (%p): acquire\n", th);
100 }
101
102 static void
103 gvl_release(rb_vm_t *vm)
104 {
105 ReleaseMutex(vm->gvl.lock);
106 }
107
108 static void
afd1a64 @kosaki * thread.c (rb_thread_schedule_rec): call gvl_yield() unconditionally.
kosaki authored
109 gvl_yield(rb_vm_t *vm, rb_thread_t *th)
110 {
111 gvl_release(th->vm);
112 native_thread_yield();
113 gvl_acquire(vm, th);
114 }
115
116
117 static void
450463d @ko1 * thread.c, vm_core.h: make gvl_acquire/release/init/destruct
ko1 authored
118 gvl_atfork(rb_vm_t *vm)
119 {
120 rb_bug("gvl_atfork() is called on win32");
121 }
122
123 static void
124 gvl_init(rb_vm_t *vm)
125 {
126 if (GVL_DEBUG) fprintf(stderr, "gvl init\n");
127 vm->gvl.lock = w32_mutex_create();
128 }
129
130 static void
131 gvl_destroy(rb_vm_t *vm)
132 {
133 if (GVL_DEBUG) fprintf(stderr, "gvl destroy\n");
134 CloseHandle(vm->gvl.lock);
135 }
136
6fc746d @nobu * thread.c (is_ruby_native_thread): check properly. [ruby-dev:31166]
nobu authored
137 static rb_thread_t *
138 ruby_thread_from_native(void)
139 {
140 return TlsGetValue(ruby_native_thread_key);
141 }
142
143 static int
144 ruby_thread_set_native(rb_thread_t *th)
145 {
146 return TlsSetValue(ruby_native_thread_key, th);
147 }
148
f40d2c9 @akr * vm.c (Init_BareVM): call Init_native_thread here.
akr authored
149 void
6fc746d @nobu * thread.c (is_ruby_native_thread): check properly. [ruby-dev:31166]
nobu authored
150 Init_native_thread(void)
a3e1b1c @ko1 * Merge YARV
ko1 authored
151 {
9c57438 @ko1 * blockinlining.c, error.c, eval.c, eval_error.h, eval_intern.h,
ko1 authored
152 rb_thread_t *th = GET_THREAD();
6fc746d @nobu * thread.c (is_ruby_native_thread): check properly. [ruby-dev:31166]
nobu authored
153
154 ruby_native_thread_key = TlsAlloc();
b451955 @unak * thread_win32.c (Init_native_thread): need to call
unak authored
155 ruby_thread_set_native(th);
a3e1b1c @ko1 * Merge YARV
ko1 authored
156 DuplicateHandle(GetCurrentProcess(),
157 GetCurrentThread(),
158 GetCurrentProcess(),
159 &th->thread_id, 0, FALSE, DUPLICATE_SAME_ACCESS);
160
161 th->native_thread_data.interrupt_event = CreateEvent(0, TRUE, FALSE, 0);
162
163 thread_debug("initial thread (th: %p, thid: %p, event: %p)\n",
164 th, GET_THREAD()->thread_id,
165 th->native_thread_data.interrupt_event);
166 }
167
168 static void
a5abb1c @ko1 * thread_win32.ci (w32_show_error_message): renamed to w32_error.
ko1 authored
169 w32_set_event(HANDLE handle)
170 {
171 if (SetEvent(handle) == 0) {
5bc85d6 @unak * thread_win32.c (w32_error): should report the function.
unak authored
172 w32_error("w32_set_event");
a5abb1c @ko1 * thread_win32.ci (w32_show_error_message): renamed to w32_error.
ko1 authored
173 }
174 }
175
176 static void
177 w32_reset_event(HANDLE handle)
178 {
179 if (ResetEvent(handle) == 0) {
5bc85d6 @unak * thread_win32.c (w32_error): should report the function.
unak authored
180 w32_error("w32_reset_event");
a5abb1c @ko1 * thread_win32.ci (w32_show_error_message): renamed to w32_error.
ko1 authored
181 }
a3e1b1c @ko1 * Merge YARV
ko1 authored
182 }
183
184 static int
bb022be @unak * thread.c (rb_thread_polling): check interrupts here.
unak authored
185 w32_wait_events(HANDLE *events, int count, DWORD timeout, rb_thread_t *th)
a3e1b1c @ko1 * Merge YARV
ko1 authored
186 {
bb022be @unak * thread.c (rb_thread_polling): check interrupts here.
unak authored
187 HANDLE *targets = events;
00f60d0 @unak * thread_win32.ci (w32_wait_events): check whether interrupt_event is
unak authored
188 HANDLE intr;
a3e1b1c @ko1 * Merge YARV
ko1 authored
189 DWORD ret;
190
bb022be @unak * thread.c (rb_thread_polling): check interrupts here.
unak authored
191 thread_debug(" w32_wait_events events:%p, count:%d, timeout:%ld, th:%p\n",
192 events, count, timeout, th);
00f60d0 @unak * thread_win32.ci (w32_wait_events): check whether interrupt_event is
unak authored
193 if (th && (intr = th->native_thread_data.interrupt_event)) {
450463d @ko1 * thread.c, vm_core.h: make gvl_acquire/release/init/destruct
ko1 authored
194 gvl_acquire(th->vm, th);
bd21118 @wanabe * thread_win32.c (w32_wait_events): get GVL before handle interrupt
wanabe authored
195 if (intr == th->native_thread_data.interrupt_event) {
196 w32_reset_event(intr);
197 if (RUBY_VM_INTERRUPTED(th)) {
198 w32_set_event(intr);
199 }
200
201 targets = ALLOCA_N(HANDLE, count + 1);
202 memcpy(targets, events, sizeof(HANDLE) * count);
203
204 targets[count++] = intr;
205 thread_debug(" * handle: %p (count: %d, intr)\n", intr, count);
a3e1b1c @ko1 * Merge YARV
ko1 authored
206 }
450463d @ko1 * thread.c, vm_core.h: make gvl_acquire/release/init/destruct
ko1 authored
207 gvl_release(th->vm);
a3e1b1c @ko1 * Merge YARV
ko1 authored
208 }
209
210 thread_debug(" WaitForMultipleObjects start (count: %d)\n", count);
bb022be @unak * thread.c (rb_thread_polling): check interrupts here.
unak authored
211 ret = WaitForMultipleObjects(count, targets, FALSE, timeout);
87e4ad0 @nobu * io.c, signal.c, thread.c, thread_win32.c, include/ruby/intern.h:
nobu authored
212 thread_debug(" WaitForMultipleObjects end (ret: %lu)\n", ret);
a3e1b1c @ko1 * Merge YARV
ko1 authored
213
060f18c @wanabe * thread_win32.c (w32_wait_events, w32_close_handle): suppress warnings.
wanabe authored
214 if (ret == (DWORD)(WAIT_OBJECT_0 + count - 1) && th) {
a3e1b1c @ko1 * Merge YARV
ko1 authored
215 errno = EINTR;
216 }
060f18c @wanabe * thread_win32.c (w32_wait_events, w32_close_handle): suppress warnings.
wanabe authored
217 if (ret == WAIT_FAILED && THREAD_DEBUG) {
a3e1b1c @ko1 * Merge YARV
ko1 authored
218 int i;
219 DWORD dmy;
220 for (i = 0; i < count; i++) {
221 thread_debug(" * error handle %d - %s\n", i,
bb022be @unak * thread.c (rb_thread_polling): check interrupts here.
unak authored
222 GetHandleInformation(targets[i], &dmy) ? "OK" : "NG");
a3e1b1c @ko1 * Merge YARV
ko1 authored
223 }
224 }
225 return ret;
226 }
227
3453b2b @ko1 * gc.h, vm_core.h: decl of rb_gc_save_machine_context()
ko1 authored
228 static void ubf_handle(void *ptr);
bb022be @unak * thread.c (rb_thread_polling): check interrupts here.
unak authored
229 #define ubf_select ubf_handle
230
231 int
c034fce @nobu * process.c (rb_waitpid_blocking, rb_waitpid): use UBF feature.
nobu authored
232 rb_w32_wait_events_blocking(HANDLE *events, int num, DWORD timeout)
233 {
234 return w32_wait_events(events, num, timeout, GET_THREAD());
235 }
236
237 int
bb022be @unak * thread.c (rb_thread_polling): check interrupts here.
unak authored
238 rb_w32_wait_events(HANDLE *events, int num, DWORD timeout)
239 {
240 int ret;
241
3453b2b @ko1 * gc.h, vm_core.h: decl of rb_gc_save_machine_context()
ko1 authored
242 BLOCKING_REGION(ret = rb_w32_wait_events_blocking(events, num, timeout),
4b645dc @mame * thread.c, thread_win32.c, vm_core.h: try to remove false positive of
mame authored
243 ubf_handle, GET_THREAD());
bb022be @unak * thread.c (rb_thread_polling): check interrupts here.
unak authored
244 return ret;
245 }
246
a5abb1c @ko1 * thread_win32.ci (w32_show_error_message): renamed to w32_error.
ko1 authored
247 static void
248 w32_close_handle(HANDLE handle)
249 {
250 if (CloseHandle(handle) == 0) {
5bc85d6 @unak * thread_win32.c (w32_error): should report the function.
unak authored
251 w32_error("w32_close_handle");
a5abb1c @ko1 * thread_win32.ci (w32_show_error_message): renamed to w32_error.
ko1 authored
252 }
253 }
254
255 static void
256 w32_resume_thread(HANDLE handle)
257 {
060f18c @wanabe * thread_win32.c (w32_wait_events, w32_close_handle): suppress warnings.
wanabe authored
258 if (ResumeThread(handle) == (DWORD)-1) {
5bc85d6 @unak * thread_win32.c (w32_error): should report the function.
unak authored
259 w32_error("w32_resume_thread");
a5abb1c @ko1 * thread_win32.ci (w32_show_error_message): renamed to w32_error.
ko1 authored
260 }
261 }
262
2840fa6 @nobu * common.mk: inverted rules order.
nobu authored
263 #ifdef _MSC_VER
264 #define HAVE__BEGINTHREADEX 1
265 #else
266 #undef HAVE__BEGINTHREADEX
267 #endif
268
269 #ifdef HAVE__BEGINTHREADEX
270 #define start_thread (HANDLE)_beginthreadex
9e0f3e0 @nobu * thread_win32.c (thread_errno): CreateThread does not set errno.
nobu authored
271 #define thread_errno errno
2840fa6 @nobu * common.mk: inverted rules order.
nobu authored
272 typedef unsigned long (_stdcall *w32_thread_start_func)(void*);
273 #else
274 #define start_thread CreateThread
9e0f3e0 @nobu * thread_win32.c (thread_errno): CreateThread does not set errno.
nobu authored
275 #define thread_errno rb_w32_map_errno(GetLastError())
2840fa6 @nobu * common.mk: inverted rules order.
nobu authored
276 typedef LPTHREAD_START_ROUTINE w32_thread_start_func;
277 #endif
278
a5abb1c @ko1 * thread_win32.ci (w32_show_error_message): renamed to w32_error.
ko1 authored
279 static HANDLE
2840fa6 @nobu * common.mk: inverted rules order.
nobu authored
280 w32_create_thread(DWORD stack_size, w32_thread_start_func func, void *val)
a5abb1c @ko1 * thread_win32.ci (w32_show_error_message): renamed to w32_error.
ko1 authored
281 {
2840fa6 @nobu * common.mk: inverted rules order.
nobu authored
282 return start_thread(0, stack_size, func, val, CREATE_SUSPENDED, 0);
a5abb1c @ko1 * thread_win32.ci (w32_show_error_message): renamed to w32_error.
ko1 authored
283 }
284
bb022be @unak * thread.c (rb_thread_polling): check interrupts here.
unak authored
285 int
286 rb_w32_sleep(unsigned long msec)
287 {
288 return w32_wait_events(0, 0, msec, GET_THREAD());
289 }
290
291 int WINAPI
292 rb_w32_Sleep(unsigned long msec)
293 {
294 int ret;
295
3453b2b @ko1 * gc.h, vm_core.h: decl of rb_gc_save_machine_context()
ko1 authored
296 BLOCKING_REGION(ret = rb_w32_sleep(msec),
4b645dc @mame * thread.c, thread_win32.c, vm_core.h: try to remove false positive of
mame authored
297 ubf_handle, GET_THREAD());
bb022be @unak * thread.c (rb_thread_polling): check interrupts here.
unak authored
298 return ret;
299 }
ae317b5 @ko1 * yarvcore.h, thread.c: fix to use pthread on cygwin.
ko1 authored
300
a3e1b1c @ko1 * Merge YARV
ko1 authored
301 static void
47e3f4e @nobu * thread.c (thread_start_func_2): wake up joining threads.
nobu authored
302 native_sleep(rb_thread_t *th, struct timeval *tv)
a3e1b1c @ko1 * Merge YARV
ko1 authored
303 {
a146829 @nobu * thread.c (sleep_forever): wait until timed out. [ruby-core:17270]
nobu authored
304 DWORD msec;
4b02286 @unak * thread_win32.c (native_sleep): fixed previous commit.
unak authored
305
a3e1b1c @ko1 * Merge YARV
ko1 authored
306 if (tv) {
307 msec = tv->tv_sec * 1000 + tv->tv_usec / 1000;
308 }
309 else {
310 msec = INFINITE;
311 }
312
313 GVL_UNLOCK_BEGIN();
314 {
a146829 @nobu * thread.c (sleep_forever): wait until timed out. [ruby-core:17270]
nobu authored
315 DWORD ret;
316
8724448 @unak * thread_win32.c (native_sleep): must block reentrance when accessing
unak authored
317 native_mutex_lock(&th->interrupt_lock);
1b63d7b @nobu * vm_core.h (struct rb_unblock_callback), thread.c
nobu authored
318 th->unblock.func = ubf_handle;
319 th->unblock.arg = th;
8724448 @unak * thread_win32.c (native_sleep): must block reentrance when accessing
unak authored
320 native_mutex_unlock(&th->interrupt_lock);
5f0b8af @ko1 * vm_core.h, thread.c, cont.c: add RUBY_VM_SET_INTERRUPT(),
ko1 authored
321
322 if (RUBY_VM_INTERRUPTED(th)) {
323 /* interrupted. return immediate */
324 }
325 else {
87e4ad0 @nobu * io.c, signal.c, thread.c, thread_win32.c, include/ruby/intern.h:
nobu authored
326 thread_debug("native_sleep start (%lu)\n", msec);
5f0b8af @ko1 * vm_core.h, thread.c, cont.c: add RUBY_VM_SET_INTERRUPT(),
ko1 authored
327 ret = w32_wait_events(0, 0, msec, th);
87e4ad0 @nobu * io.c, signal.c, thread.c, thread_win32.c, include/ruby/intern.h:
nobu authored
328 thread_debug("native_sleep done (%lu)\n", ret);
5f0b8af @ko1 * vm_core.h, thread.c, cont.c: add RUBY_VM_SET_INTERRUPT(),
ko1 authored
329 }
330
8724448 @unak * thread_win32.c (native_sleep): must block reentrance when accessing
unak authored
331 native_mutex_lock(&th->interrupt_lock);
1b63d7b @nobu * vm_core.h (struct rb_unblock_callback), thread.c
nobu authored
332 th->unblock.func = 0;
333 th->unblock.arg = 0;
8724448 @unak * thread_win32.c (native_sleep): must block reentrance when accessing
unak authored
334 native_mutex_unlock(&th->interrupt_lock);
a3e1b1c @ko1 * Merge YARV
ko1 authored
335 }
336 GVL_UNLOCK_END();
337 }
338
42f0b52 @ko1 * thread_pthread.c, thread_pthread.h, thread_win32.c,
ko1 authored
339 static int
8ee7d07 @ko1 * blockinlining.c, compile.c, compile.h, error.c, eval.c,
ko1 authored
340 native_mutex_lock(rb_thread_lock_t *lock)
a3e1b1c @ko1 * Merge YARV
ko1 authored
341 {
342 #if USE_WIN32_MUTEX
450463d @ko1 * thread.c, vm_core.h: make gvl_acquire/release/init/destruct
ko1 authored
343 w32_mutex_lock(*lock);
a3e1b1c @ko1 * Merge YARV
ko1 authored
344 #else
345 EnterCriticalSection(lock);
346 return 0;
347 #endif
348 }
349
42f0b52 @ko1 * thread_pthread.c, thread_pthread.h, thread_win32.c,
ko1 authored
350 static int
8ee7d07 @ko1 * blockinlining.c, compile.c, compile.h, error.c, eval.c,
ko1 authored
351 native_mutex_unlock(rb_thread_lock_t *lock)
a3e1b1c @ko1 * Merge YARV
ko1 authored
352 {
353 #if USE_WIN32_MUTEX
354 thread_debug("release mutex: %p\n", *lock);
355 return ReleaseMutex(*lock);
356 #else
357 LeaveCriticalSection(lock);
358 return 0;
359 #endif
360 }
361
42f0b52 @ko1 * thread_pthread.c, thread_pthread.h, thread_win32.c,
ko1 authored
362 static int
8ee7d07 @ko1 * blockinlining.c, compile.c, compile.h, error.c, eval.c,
ko1 authored
363 native_mutex_trylock(rb_thread_lock_t *lock)
a3e1b1c @ko1 * Merge YARV
ko1 authored
364 {
35eb542 @nobu * thread_win32.ci: fixed typo.
nobu authored
365 #if USE_WIN32_MUTEX
a3e1b1c @ko1 * Merge YARV
ko1 authored
366 int result;
367 thread_debug("native_mutex_trylock: %p\n", *lock);
bb022be @unak * thread.c (rb_thread_polling): check interrupts here.
unak authored
368 result = w32_wait_events(&*lock, 1, 1, 0);
a3e1b1c @ko1 * Merge YARV
ko1 authored
369 thread_debug("native_mutex_trylock result: %d\n", result);
370 switch (result) {
99d65b1 @nobu * compile.c, dir.c, eval.c, eval_jump.h, eval_method.h, numeric.c,
nobu authored
371 case WAIT_OBJECT_0:
a3e1b1c @ko1 * Merge YARV
ko1 authored
372 return 0;
99d65b1 @nobu * compile.c, dir.c, eval.c, eval_jump.h, eval_method.h, numeric.c,
nobu authored
373 case WAIT_TIMEOUT:
a3e1b1c @ko1 * Merge YARV
ko1 authored
374 return EBUSY;
375 }
376 return EINVAL;
377 #else
378 return TryEnterCriticalSection(lock) == 0;
379 #endif
380 }
381
42f0b52 @ko1 * thread_pthread.c, thread_pthread.h, thread_win32.c,
ko1 authored
382 static void
8ee7d07 @ko1 * blockinlining.c, compile.c, compile.h, error.c, eval.c,
ko1 authored
383 native_mutex_initialize(rb_thread_lock_t *lock)
a3e1b1c @ko1 * Merge YARV
ko1 authored
384 {
35eb542 @nobu * thread_win32.ci: fixed typo.
nobu authored
385 #if USE_WIN32_MUTEX
450463d @ko1 * thread.c, vm_core.h: make gvl_acquire/release/init/destruct
ko1 authored
386 *lock = w32_mutex_create();
205f310 @nobu * call_cfunc.ci, compile.c, compile.h, debug.h, eval.c,
nobu authored
387 /* thread_debug("initialize mutex: %p\n", *lock); */
a3e1b1c @ko1 * Merge YARV
ko1 authored
388 #else
389 InitializeCriticalSection(lock);
390 #endif
391 }
392
42f0b52 @ko1 * thread_pthread.c, thread_pthread.h, thread_win32.c,
ko1 authored
393 static void
a902624 @ko1 * thread.c, thread_pthread.ci, thread_win32.ci (thread_start_func_1):
ko1 authored
394 native_mutex_destroy(rb_thread_lock_t *lock)
395 {
35eb542 @nobu * thread_win32.ci: fixed typo.
nobu authored
396 #if USE_WIN32_MUTEX
a5abb1c @ko1 * thread_win32.ci (w32_show_error_message): renamed to w32_error.
ko1 authored
397 w32_close_handle(lock);
398 #else
399 DeleteCriticalSection(lock);
400 #endif
a902624 @ko1 * thread.c, thread_pthread.ci, thread_win32.ci (thread_start_func_1):
ko1 authored
401 }
402
a73ba1d @unak * thread_win32.[ch] (cond_every_entry, rb_thread_cond_struct): reverted
unak authored
403 struct cond_event_entry {
404 struct cond_event_entry* next;
94e4d61 @kosaki fix win32 native_cond_timedwait() makes SIGSEGV.
kosaki authored
405 struct cond_event_entry* prev;
a73ba1d @unak * thread_win32.[ch] (cond_every_entry, rb_thread_cond_struct): reverted
unak authored
406 HANDLE event;
407 };
408
42f0b52 @ko1 * thread_pthread.c, thread_pthread.h, thread_win32.c,
ko1 authored
409 static void
6244e50 @ko1 * thread.c: fix Mutex to be interruptable lock.
ko1 authored
410 native_cond_signal(rb_thread_cond_t *cond)
411 {
412 /* cond is guarded by mutex */
413 struct cond_event_entry *e = cond->next;
94e4d61 @kosaki fix win32 native_cond_timedwait() makes SIGSEGV.
kosaki authored
414 struct cond_event_entry *head = (struct cond_event_entry*)cond;
415
416 if (e != head) {
417 struct cond_event_entry *next = e->next;
418 struct cond_event_entry *prev = e->prev;
419
420 prev->next = next;
421 next->prev = prev;
422 e->next = e->prev = e;
6244e50 @ko1 * thread.c: fix Mutex to be interruptable lock.
ko1 authored
423
424 SetEvent(e->event);
425 }
426 }
427
42f0b52 @ko1 * thread_pthread.c, thread_pthread.h, thread_win32.c,
ko1 authored
428 static void
6244e50 @ko1 * thread.c: fix Mutex to be interruptable lock.
ko1 authored
429 native_cond_broadcast(rb_thread_cond_t *cond)
430 {
431 /* cond is guarded by mutex */
432 struct cond_event_entry *e = cond->next;
94e4d61 @kosaki fix win32 native_cond_timedwait() makes SIGSEGV.
kosaki authored
433 struct cond_event_entry *head = (struct cond_event_entry*)cond;
434
435 while (e != head) {
436 struct cond_event_entry *next = e->next;
437 struct cond_event_entry *prev = e->prev;
6244e50 @ko1 * thread.c: fix Mutex to be interruptable lock.
ko1 authored
438
439 SetEvent(e->event);
94e4d61 @kosaki fix win32 native_cond_timedwait() makes SIGSEGV.
kosaki authored
440
441 prev->next = next;
442 next->prev = prev;
443 e->next = e->prev = e;
444
445 e = next;
6244e50 @ko1 * thread.c: fix Mutex to be interruptable lock.
ko1 authored
446 }
447 }
448
b4c5fad @kosaki * thread_win32.c (native_cond_timedwait): New. r31373 caused
kosaki authored
449
450 static int
451 __cond_timedwait(rb_thread_cond_t *cond, rb_thread_lock_t *mutex, unsigned long msec)
6244e50 @ko1 * thread.c: fix Mutex to be interruptable lock.
ko1 authored
452 {
453 DWORD r;
454 struct cond_event_entry entry;
94e4d61 @kosaki fix win32 native_cond_timedwait() makes SIGSEGV.
kosaki authored
455 struct cond_event_entry *head = (struct cond_event_entry*)cond;
6244e50 @ko1 * thread.c: fix Mutex to be interruptable lock.
ko1 authored
456
457 entry.event = CreateEvent(0, FALSE, FALSE, 0);
458
459 /* cond is guarded by mutex */
94e4d61 @kosaki fix win32 native_cond_timedwait() makes SIGSEGV.
kosaki authored
460 entry.next = head;
461 entry.prev = head->prev;
462 head->prev->next = &entry;
463 head->prev = &entry;
6244e50 @ko1 * thread.c: fix Mutex to be interruptable lock.
ko1 authored
464
465 native_mutex_unlock(mutex);
466 {
b4c5fad @kosaki * thread_win32.c (native_cond_timedwait): New. r31373 caused
kosaki authored
467 r = WaitForSingleObject(entry.event, msec);
468 if ((r != WAIT_OBJECT_0) && (r != WAIT_TIMEOUT)) {
87e4ad0 @nobu * io.c, signal.c, thread.c, thread_win32.c, include/ruby/intern.h:
nobu authored
469 rb_bug("native_cond_wait: WaitForSingleObject returns %lu", r);
6244e50 @ko1 * thread.c: fix Mutex to be interruptable lock.
ko1 authored
470 }
471 }
472 native_mutex_lock(mutex);
473
94e4d61 @kosaki fix win32 native_cond_timedwait() makes SIGSEGV.
kosaki authored
474 entry.prev->next = entry.next;
475 entry.next->prev = entry.prev;
476
6244e50 @ko1 * thread.c: fix Mutex to be interruptable lock.
ko1 authored
477 w32_close_handle(entry.event);
b4c5fad @kosaki * thread_win32.c (native_cond_timedwait): New. r31373 caused
kosaki authored
478 return (r == WAIT_OBJECT_0) ? 0 : ETIMEDOUT;
479 }
480
481 static int
482 native_cond_wait(rb_thread_cond_t *cond, rb_thread_lock_t *mutex)
483 {
484 return __cond_timedwait(cond, mutex, INFINITE);
485 }
486
487 static unsigned long
488 abs_timespec_to_timeout_ms(struct timespec *ts)
489 {
490 struct timeval tv;
491 struct timeval now;
492
493 gettimeofday(&now, NULL);
494 tv.tv_sec = ts->tv_sec;
471fb33 @kosaki fix mutex deadlock test hang-up.
kosaki authored
495 tv.tv_usec = ts->tv_nsec / 1000;
b4c5fad @kosaki * thread_win32.c (native_cond_timedwait): New. r31373 caused
kosaki authored
496
497 if (!rb_w32_time_subtract(&tv, &now))
498 return 0;
499
500 return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
501 }
502
503 static int
504 native_cond_timedwait(rb_thread_cond_t *cond, rb_thread_lock_t *mutex, struct timespec *ts)
505 {
506 unsigned long timeout_ms;
507
508 timeout_ms = abs_timespec_to_timeout_ms(ts);
509 if (!timeout_ms)
510 return ETIMEDOUT;
511
512 return __cond_timedwait(cond, mutex, timeout_ms);
6244e50 @ko1 * thread.c: fix Mutex to be interruptable lock.
ko1 authored
513 }
514
7ac6b70 @kosaki sleep_cond use monotonic time if possible.
kosaki authored
515 #if SIZEOF_TIME_T == SIZEOF_LONG
516 typedef unsigned long unsigned_time_t;
517 #elif SIZEOF_TIME_T == SIZEOF_INT
518 typedef unsigned int unsigned_time_t;
519 #elif SIZEOF_TIME_T == SIZEOF_LONG_LONG
520 typedef unsigned LONG_LONG unsigned_time_t;
521 #else
522 # error cannot find integer type which size is same as time_t.
523 #endif
524
525 #define TIMET_MAX (~(time_t)0 <= 0 ? (time_t)((~(unsigned_time_t)0) >> 1) : (time_t)(~(unsigned_time_t)0))
526
b2ea836 @kosaki mutex: deadlock check timeout use monotonic time.
kosaki authored
527 static struct timespec
528 native_cond_timeout(rb_thread_cond_t *cond, struct timespec timeout_rel)
529 {
530 int ret;
531 struct timeval tv;
532 struct timespec timeout;
7ac6b70 @kosaki sleep_cond use monotonic time if possible.
kosaki authored
533 struct timespec now;
b2ea836 @kosaki mutex: deadlock check timeout use monotonic time.
kosaki authored
534
535 ret = gettimeofday(&tv, 0);
536 if (ret != 0)
537 rb_sys_fail(0);
7ac6b70 @kosaki sleep_cond use monotonic time if possible.
kosaki authored
538 now.tv_sec = tv.tv_sec;
539 now.tv_nsec = tv.tv_usec * 1000;
b2ea836 @kosaki mutex: deadlock check timeout use monotonic time.
kosaki authored
540
7ac6b70 @kosaki sleep_cond use monotonic time if possible.
kosaki authored
541 timeout.tv_sec = now.tv_sec;
542 timeout.tv_nsec = now.tv_nsec;
b2ea836 @kosaki mutex: deadlock check timeout use monotonic time.
kosaki authored
543 timeout.tv_sec += timeout_rel.tv_sec;
544 timeout.tv_nsec += timeout_rel.tv_nsec;
7ac6b70 @kosaki sleep_cond use monotonic time if possible.
kosaki authored
545
b2ea836 @kosaki mutex: deadlock check timeout use monotonic time.
kosaki authored
546 if (timeout.tv_nsec >= 1000*1000*1000) {
547 timeout.tv_sec++;
548 timeout.tv_nsec -= 1000*1000*1000;
549 }
7ac6b70 @kosaki sleep_cond use monotonic time if possible.
kosaki authored
550
551 if (timeout.tv_sec < now.tv_sec)
552 timeout.tv_sec = TIMET_MAX;
553
b2ea836 @kosaki mutex: deadlock check timeout use monotonic time.
kosaki authored
554 return timeout;
555 }
556
42f0b52 @ko1 * thread_pthread.c, thread_pthread.h, thread_win32.c,
ko1 authored
557 static void
a1cfaf4 @kosaki * thread_pthread.h (rb_thread_cond_t): add clockid field. it's
kosaki authored
558 native_cond_initialize(rb_thread_cond_t *cond, int flags)
6244e50 @ko1 * thread.c: fix Mutex to be interruptable lock.
ko1 authored
559 {
94e4d61 @kosaki fix win32 native_cond_timedwait() makes SIGSEGV.
kosaki authored
560 cond->next = (struct cond_event_entry *)cond;
561 cond->prev = (struct cond_event_entry *)cond;
6244e50 @ko1 * thread.c: fix Mutex to be interruptable lock.
ko1 authored
562 }
563
42f0b52 @ko1 * thread_pthread.c, thread_pthread.h, thread_win32.c,
ko1 authored
564 static void
6244e50 @ko1 * thread.c: fix Mutex to be interruptable lock.
ko1 authored
565 native_cond_destroy(rb_thread_cond_t *cond)
566 {
567 /* */
568 }
a902624 @ko1 * thread.c, thread_pthread.ci, thread_win32.ci (thread_start_func_1):
ko1 authored
569
fc3c60f @nobu * gc.h (STACK_UPPER): moved from gc.c
nobu authored
570 void
c7853b4 @nobu * eval.c (ruby_cleanup): the order of local variables on stack is
nobu authored
571 ruby_init_stack(volatile VALUE *addr)
fc3c60f @nobu * gc.h (STACK_UPPER): moved from gc.c
nobu authored
572 {
573 }
574
575 #define CHECK_ERR(expr) \
576 {if (!(expr)) {rb_bug("err: %lu - %s", GetLastError(), #expr);}}
577
578 static void
579 native_thread_init_stack(rb_thread_t *th)
580 {
581 MEMORY_BASIC_INFORMATION mi;
582 char *base, *end;
583 DWORD size, space;
584
585 CHECK_ERR(VirtualQuery(&mi, &mi, sizeof(mi)));
586 base = mi.AllocationBase;
587 end = mi.BaseAddress;
588 end += mi.RegionSize;
589 size = end - base;
590 space = size / 5;
591 if (space > 1024*1024) space = 1024*1024;
592 th->machine_stack_start = (VALUE *)end - 1;
593 th->machine_stack_maxsize = size - space;
594 }
595
dfc07e8 @unak * thread_win32.c (InterlockedExchangePointer): old SDK support.
unak authored
596 #ifndef InterlockedExchangePointer
597 #define InterlockedExchangePointer(t, v) \
598 (void *)InterlockedExchange((long *)(t), (long)(v))
599 #endif
a902624 @ko1 * thread.c, thread_pthread.ci, thread_win32.ci (thread_start_func_1):
ko1 authored
600 static void
601 native_thread_destroy(rb_thread_t *th)
602 {
9f90682 @unak * thread_win32.c (native_thread_destroy): decreased the probability of
unak authored
603 HANDLE intr = InterlockedExchangePointer(&th->native_thread_data.interrupt_event, 0);
00f60d0 @unak * thread_win32.ci (w32_wait_events): check whether interrupt_event is
unak authored
604 thread_debug("close handle - intr: %p, thid: %p\n", intr, th->thread_id);
605 w32_close_handle(intr);
a902624 @ko1 * thread.c, thread_pthread.ci, thread_win32.ci (thread_start_func_1):
ko1 authored
606 }
a3e1b1c @ko1 * Merge YARV
ko1 authored
607
2840fa6 @nobu * common.mk: inverted rules order.
nobu authored
608 static unsigned long _stdcall
a3e1b1c @ko1 * Merge YARV
ko1 authored
609 thread_start_func_1(void *th_ptr)
610 {
9c57438 @ko1 * blockinlining.c, error.c, eval.c, eval_error.h, eval_intern.h,
ko1 authored
611 rb_thread_t *th = th_ptr;
a5abb1c @ko1 * thread_win32.ci (w32_show_error_message): renamed to w32_error.
ko1 authored
612 volatile HANDLE thread_id = th->thread_id;
613
fc3c60f @nobu * gc.h (STACK_UPPER): moved from gc.c
nobu authored
614 native_thread_init_stack(th);
a5abb1c @ko1 * thread_win32.ci (w32_show_error_message): renamed to w32_error.
ko1 authored
615 th->native_thread_data.interrupt_event = CreateEvent(0, TRUE, FALSE, 0);
a3e1b1c @ko1 * Merge YARV
ko1 authored
616
a5abb1c @ko1 * thread_win32.ci (w32_show_error_message): renamed to w32_error.
ko1 authored
617 /* run */
a3e1b1c @ko1 * Merge YARV
ko1 authored
618 thread_debug("thread created (th: %p, thid: %p, event: %p)\n", th,
619 th->thread_id, th->native_thread_data.interrupt_event);
5732566 @nobu * thread.c (rb_thread_stop_timer_thread): terminates timer thread
nobu authored
620
df6ea23 @nobu * thread_win32.c (thread_start_func_1): use already gotten stack info.
nobu authored
621 thread_start_func_2(th, th->machine_stack_start, rb_ia64_bsp());
a3e1b1c @ko1 * Merge YARV
ko1 authored
622
a5abb1c @ko1 * thread_win32.ci (w32_show_error_message): renamed to w32_error.
ko1 authored
623 w32_close_handle(thread_id);
a3e1b1c @ko1 * Merge YARV
ko1 authored
624 thread_debug("thread deleted (th: %p)\n", th);
625 return 0;
626 }
627
628 static int
9c57438 @ko1 * blockinlining.c, error.c, eval.c, eval_error.h, eval_intern.h,
ko1 authored
629 native_thread_create(rb_thread_t *th)
a3e1b1c @ko1 * Merge YARV
ko1 authored
630 {
a902624 @ko1 * thread.c, thread_pthread.ci, thread_win32.ci (thread_start_func_1):
ko1 authored
631 size_t stack_size = 4 * 1024; /* 4KB */
632 th->thread_id = w32_create_thread(stack_size, thread_start_func_1, th);
a3e1b1c @ko1 * Merge YARV
ko1 authored
633
a902624 @ko1 * thread.c, thread_pthread.ci, thread_win32.ci (thread_start_func_1):
ko1 authored
634 if ((th->thread_id) == 0) {
9e0f3e0 @nobu * thread_win32.c (thread_errno): CreateThread does not set errno.
nobu authored
635 return thread_errno;
a3e1b1c @ko1 * Merge YARV
ko1 authored
636 }
a5abb1c @ko1 * thread_win32.ci (w32_show_error_message): renamed to w32_error.
ko1 authored
637
638 w32_resume_thread(th->thread_id);
639
a3e1b1c @ko1 * Merge YARV
ko1 authored
640 if (THREAD_DEBUG) {
641 Sleep(0);
cea3919 @nobu * configure.in (RUBY_CHECK_PRINTF_PREFIX): check for printf format
nobu authored
642 thread_debug("create: (th: %p, thid: %p, intr: %p), stack size: %"PRIdSIZE"\n",
a3e1b1c @ko1 * Merge YARV
ko1 authored
643 th, th->thread_id,
644 th->native_thread_data.interrupt_event, stack_size);
645 }
646 return 0;
647 }
648
649 static void
84f8da1 @ko1 * thread.c (rb_thread_stop_timer_thread(), rb_thread_reset_timer_thre…
ko1 authored
650 native_thread_join(HANDLE th)
651 {
6198f53 @unak * thread_win32.c (native_thread_join): need to wait thread, of course.
unak authored
652 w32_wait_events(&th, 1, INFINITE, 0);
84f8da1 @ko1 * thread.c (rb_thread_stop_timer_thread(), rb_thread_reset_timer_thre…
ko1 authored
653 }
654
16612b3 @ko1 * thread.c, vm_core.h: add manual priority support
ko1 authored
655 #if USE_NATIVE_THREAD_PRIORITY
656
84f8da1 @ko1 * thread.c (rb_thread_stop_timer_thread(), rb_thread_reset_timer_thre…
ko1 authored
657 static void
9c57438 @ko1 * blockinlining.c, error.c, eval.c, eval_error.h, eval_intern.h,
ko1 authored
658 native_thread_apply_priority(rb_thread_t *th)
a3e1b1c @ko1 * Merge YARV
ko1 authored
659 {
660 int priority = th->priority;
661 if (th->priority > 0) {
662 priority = THREAD_PRIORITY_ABOVE_NORMAL;
663 }
664 else if (th->priority < 0) {
665 priority = THREAD_PRIORITY_BELOW_NORMAL;
666 }
667 else {
668 priority = THREAD_PRIORITY_NORMAL;
669 }
670
671 SetThreadPriority(th->thread_id, priority);
672 }
673
16612b3 @ko1 * thread.c, vm_core.h: add manual priority support
ko1 authored
674 #endif /* USE_NATIVE_THREAD_PRIORITY */
675
a8bdd28 @unak * thread.c (do_select): Windows: no need to poll if select(2) is
unak authored
676 int rb_w32_select_with_thread(int, fd_set *, fd_set *, fd_set *, struct timeval *, void *); /* @internal */
677
678 static int
679 native_fd_select(int n, rb_fdset_t *readfds, rb_fdset_t *writefds, rb_fdset_t *exceptfds, struct timeval *timeout, rb_thread_t *th)
680 {
681 fd_set *r = NULL, *w = NULL, *e = NULL;
682 if (readfds) {
683 rb_fd_resize(n - 1, readfds);
684 r = rb_fd_ptr(readfds);
685 }
686 if (writefds) {
687 rb_fd_resize(n - 1, writefds);
688 w = rb_fd_ptr(writefds);
689 }
690 if (exceptfds) {
691 rb_fd_resize(n - 1, exceptfds);
692 e = rb_fd_ptr(exceptfds);
693 }
694 return rb_w32_select_with_thread(n, r, w, e, timeout, th);
695 }
696
697 /* @internal */
698 int
699 rb_w32_check_interrupt(rb_thread_t *th)
700 {
701 return w32_wait_events(0, 0, 0, th);
702 }
703
a3e1b1c @ko1 * Merge YARV
ko1 authored
704 static void
3453b2b @ko1 * gc.h, vm_core.h: decl of rb_gc_save_machine_context()
ko1 authored
705 ubf_handle(void *ptr)
a3e1b1c @ko1 * Merge YARV
ko1 authored
706 {
3453b2b @ko1 * gc.h, vm_core.h: decl of rb_gc_save_machine_context()
ko1 authored
707 rb_thread_t *th = (rb_thread_t *)ptr;
ae317b5 @ko1 * yarvcore.h, thread.c: fix to use pthread on cygwin.
ko1 authored
708 thread_debug("ubf_handle: %p\n", th);
25498d2 @unak * thread_win32.c (ubf_handle): cancel blocking IO if it can (only
unak authored
709
a5abb1c @ko1 * thread_win32.ci (w32_show_error_message): renamed to w32_error.
ko1 authored
710 w32_set_event(th->native_thread_data.interrupt_event);
a3e1b1c @ko1 * Merge YARV
ko1 authored
711 }
712
84f8da1 @ko1 * thread.c (rb_thread_stop_timer_thread(), rb_thread_reset_timer_thre…
ko1 authored
713 static HANDLE timer_thread_id = 0;
5732566 @nobu * thread.c (rb_thread_stop_timer_thread): terminates timer thread
nobu authored
714 static HANDLE timer_thread_lock;
a3e1b1c @ko1 * Merge YARV
ko1 authored
715
2840fa6 @nobu * common.mk: inverted rules order.
nobu authored
716 static unsigned long _stdcall
a3e1b1c @ko1 * Merge YARV
ko1 authored
717 timer_thread_func(void *dummy)
718 {
719 thread_debug("timer_thread\n");
bcfc22b @kosaki * thread_pthread.c: rewrite GVL completely.
kosaki authored
720 while (WaitForSingleObject(timer_thread_lock, TIME_QUANTUM_USEC/1000) ==
5732566 @nobu * thread.c (rb_thread_stop_timer_thread): terminates timer thread
nobu authored
721 WAIT_TIMEOUT) {
6bbbf98 @nobu * thread.c (thread_initialize): NUM2INT() returns int.
nobu authored
722 timer_thread_function(dummy);
a3e1b1c @ko1 * Merge YARV
ko1 authored
723 }
724 thread_debug("timer killed\n");
725 return 0;
726 }
727
d1d5d5e @ko1 * thread_pthread.c: Stop polling in the timer thread when there are
ko1 authored
728 void
729 rb_thread_wakeup_timer_thread(void)
730 {
731 /* do nothing */
732 }
733
5732566 @nobu * thread.c (rb_thread_stop_timer_thread): terminates timer thread
nobu authored
734 static void
a3e1b1c @ko1 * Merge YARV
ko1 authored
735 rb_thread_create_timer_thread(void)
736 {
84f8da1 @ko1 * thread.c (rb_thread_stop_timer_thread(), rb_thread_reset_timer_thre…
ko1 authored
737 if (timer_thread_id == 0) {
5732566 @nobu * thread.c (rb_thread_stop_timer_thread): terminates timer thread
nobu authored
738 if (!timer_thread_lock) {
739 timer_thread_lock = CreateEvent(0, TRUE, FALSE, 0);
740 }
a534e39 @nobu * thread_{pthread,win32}.c (rb_thread_create_timer_thread): needs more
nobu authored
741 timer_thread_id = w32_create_thread(1024 + (THREAD_DEBUG ? BUFSIZ : 0),
5732566 @nobu * thread.c (rb_thread_stop_timer_thread): terminates timer thread
nobu authored
742 timer_thread_func, 0);
a5abb1c @ko1 * thread_win32.ci (w32_show_error_message): renamed to w32_error.
ko1 authored
743 w32_resume_thread(timer_thread_id);
a3e1b1c @ko1 * Merge YARV
ko1 authored
744 }
745 }
746
641f43d @nobu * thread_pthread.c (thread_timer): checks working flags again.
nobu authored
747 static int
748 native_stop_timer_thread(void)
749 {
750 int stopped = --system_working <= 0;
751 if (stopped) {
9ee5e61 @unak * thread_{pthread,win32}.c (native_stop_timer_thread): join the thread
unak authored
752 SetEvent(timer_thread_lock);
753 native_thread_join(timer_thread_id);
641f43d @nobu * thread_pthread.c (thread_timer): checks working flags again.
nobu authored
754 CloseHandle(timer_thread_lock);
755 timer_thread_lock = 0;
756 }
757 return stopped;
758 }
5732566 @nobu * thread.c (rb_thread_stop_timer_thread): terminates timer thread
nobu authored
759
9ee5e61 @unak * thread_{pthread,win32}.c (native_stop_timer_thread): join the thread
unak authored
760 static void
761 native_reset_timer_thread(void)
762 {
763 if (timer_thread_id) {
764 CloseHandle(timer_thread_id);
765 timer_thread_id = 0;
766 }
767 }
768
767d708 @nobu * Makefile.in (ASFLAGS): needs INCFLAGS.
nobu authored
769 #ifdef RUBY_ALLOCA_CHKSTK
770 void
771 ruby_alloca_chkstk(size_t len, void *sp)
772 {
773 if (ruby_stack_length(NULL) * sizeof(VALUE) >= len) {
774 rb_thread_t *th = GET_THREAD();
775 if (!rb_thread_raised_p(th, RAISED_STACKOVERFLOW)) {
776 rb_thread_raised_set(th, RAISED_STACKOVERFLOW);
777 rb_exc_raise(sysstack_error);
778 }
779 }
780 }
781 #endif
a3e1b1c @ko1 * Merge YARV
ko1 authored
782 #endif /* THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION */
Something went wrong with that request. Please try again.