X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmetadata%2Fthreadpool-ms.c;h=1f4a6cc605237a36e6f13c3a28acc3c229086dff;hb=7ebae4c7f57a6c1b4d0a38e69f270a016b6f3143;hp=4cda0e814d52d17bb32ba12f4bc0abc5816b1a85;hpb=85f5330e8fbd1af516dd65684e9cb4aef42a2015;p=mono.git diff --git a/mono/metadata/threadpool-ms.c b/mono/metadata/threadpool-ms.c index 4cda0e814d5..1f4a6cc6052 100644 --- a/mono/metadata/threadpool-ms.c +++ b/mono/metadata/threadpool-ms.c @@ -708,13 +708,15 @@ worker_try_create (void) { ThreadPoolCounter counter; MonoInternalThread *thread; + gint64 current_ticks; gint32 now; mono_coop_mutex_lock (&threadpool->worker_creation_lock); mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try create worker", mono_native_thread_id_get ()); - - if ((now = mono_100ns_ticks () / 10 / 1000 / 1000) == 0) { + current_ticks = mono_100ns_ticks (); + now = current_ticks / (10 * 1000 * 1000); + if (0 == current_ticks) { g_warning ("failed to get 100ns ticks"); } else { if (threadpool->worker_creation_current_second != now) { @@ -1366,11 +1368,11 @@ mono_threadpool_ms_begin_invoke (MonoDomain *domain, MonoObject *target, MonoMet } MonoObject * -mono_threadpool_ms_end_invoke (MonoAsyncResult *ares, MonoArray **out_args, MonoObject **exc) +mono_threadpool_ms_end_invoke (MonoAsyncResult *ares, MonoArray **out_args, MonoObject **exc, MonoError *error) { - MonoError error; MonoAsyncCall *ac; + mono_error_init (error); g_assert (exc); g_assert (out_args); @@ -1381,7 +1383,7 @@ mono_threadpool_ms_end_invoke (MonoAsyncResult *ares, MonoArray **out_args, Mono mono_monitor_enter ((MonoObject*) ares); if (ares->endinvoke_called) { - *exc = (MonoObject*) mono_get_exception_invalid_operation (NULL); + mono_error_set_invalid_operation(error, "Delegate EndInvoke method called more than once"); mono_monitor_exit ((MonoObject*) ares); return NULL; } @@ -1398,8 +1400,11 @@ mono_threadpool_ms_end_invoke (MonoAsyncResult *ares, MonoArray **out_args, Mono } else { wait_event = CreateEvent (NULL, TRUE, FALSE, NULL); g_assert(wait_event); - MonoWaitHandle *wait_handle = mono_wait_handle_new (mono_object_domain (ares), wait_event, &error); - mono_error_raise_exception (&error); /* FIXME don't raise here */ + MonoWaitHandle *wait_handle = mono_wait_handle_new (mono_object_domain (ares), wait_event, error); + if (!is_ok (error)) { + CloseHandle (wait_event); + return NULL; + } MONO_OBJECT_SETREF (ares, handle, (MonoObject*) wait_handle); } mono_monitor_exit ((MonoObject*) ares);