gint32
mono_thread_get_tls_offset (void)
{
- int offset;
+ int offset = -1;
+
+#ifdef HOST_WIN32
+ if (current_object_key)
+ offset = current_object_key;
+#else
MONO_THREAD_VAR_OFFSET (tls_current_object,offset);
+#endif
return offset;
}
g_assert (start_delegate != NULL);
args [0] = start_arg;
/* we may want to handle the exception here. See comment below on unhandled exceptions */
- mono_runtime_delegate_invoke (start_delegate, args, NULL);
+ mono_runtime_delegate_invoke_checked (start_delegate, args, &error);
+ mono_error_raise_exception (&error); /* FIXME don't raise here */
}
/* If the thread calls ExitThread at all, this remaining code
*/
THREAD_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") waiting for thread %p (%"G_GSIZE_FORMAT") to start", __func__, mono_native_thread_id_get (), internal, (gsize)internal->tid));
- MONO_PREPARE_BLOCKING;
+ MONO_ENTER_GC_SAFE;
WaitForSingleObjectEx (internal->start_notify, INFINITE, FALSE);
- MONO_FINISH_BLOCKING;
+ MONO_EXIT_GC_SAFE;
CloseHandle (internal->start_notify);
internal->start_notify = NULL;
mono_thread_set_state (cur_thread, ThreadState_WaitSleepJoin);
- MONO_PREPARE_BLOCKING;
+ MONO_ENTER_GC_SAFE;
ret=WaitForSingleObjectEx (handle, ms, TRUE);
- MONO_FINISH_BLOCKING;
+ MONO_EXIT_GC_SAFE;
mono_thread_clr_state (cur_thread, ThreadState_WaitSleepJoin);
start = (ms == -1) ? 0 : mono_100ns_ticks ();
do {
- MONO_PREPARE_BLOCKING;
+ MONO_ENTER_GC_SAFE;
if (multiple)
ret = WaitForMultipleObjectsEx (numhandles, handles, waitall, wait, alertable);
else
ret = WaitForSingleObjectEx (handles [0], ms, alertable);
- MONO_FINISH_BLOCKING;
+ MONO_EXIT_GC_SAFE;
if (ret != WAIT_IO_COMPLETION)
break;
mono_thread_set_state (thread, ThreadState_WaitSleepJoin);
- MONO_PREPARE_BLOCKING;
+ MONO_ENTER_GC_SAFE;
ret = SignalObjectAndWait (toSignal, toWait, ms, TRUE);
- MONO_FINISH_BLOCKING;
+ MONO_EXIT_GC_SAFE;
mono_thread_clr_state (thread, ThreadState_WaitSleepJoin);
THREAD_DEBUG (g_message("%s: %d threads to wait for in this batch", __func__, wait->num));
- MONO_PREPARE_BLOCKING;
+ MONO_ENTER_GC_SAFE;
ret=WaitForMultipleObjectsEx(wait->num, wait->handles, TRUE, timeout, TRUE);
- MONO_FINISH_BLOCKING;
+ MONO_EXIT_GC_SAFE;
if(ret==WAIT_FAILED) {
/* See the comment in build_wait_tids() */
count++;
}
- MONO_PREPARE_BLOCKING;
+ MONO_ENTER_GC_SAFE;
ret=WaitForMultipleObjectsEx (count, wait->handles, FALSE, timeout, TRUE);
- MONO_FINISH_BLOCKING;
+ MONO_EXIT_GC_SAFE;
if(ret==WAIT_FAILED) {
/* See the comment in build_wait_tids() */
if (handle == NULL)
return FALSE;
- /* printf ("A: %d\n", wait->num); */
- wait->handles[wait->num]=thread->handle;
- wait->threads[wait->num]=thread;
+ wait->handles[wait->num] = handle;
+ wait->threads[wait->num] = thread;
wait->num++;
THREAD_DEBUG (g_print ("%s: Aborting id: %"G_GSIZE_FORMAT"\n", __func__, (gsize)thread->tid));