if (state == TRUE) {
/* Tell everyone blocking on a single handle */
+ /* The condition the global signal cond is waiting on is the signalling of
+ * _any_ handle. So lock it before setting the signalled state.
+ */
+ pthread_cleanup_push ((void(*)(void *))mono_mutex_unlock_in_cleanup, (void *)_wapi_global_signal_mutex);
+ thr_ret = mono_mutex_lock (_wapi_global_signal_mutex);
+ if (thr_ret != 0)
+ g_warning ("Bad call to mono_mutex_lock result %d for global signal mutex", thr_ret);
+ g_assert (thr_ret == 0);
+
/* This function _must_ be called with
* handle->signal_mutex locked
*/
if (broadcast == TRUE) {
thr_ret = pthread_cond_broadcast (&handle_data->signal_cond);
+ if (thr_ret != 0)
+ g_warning ("Bad call to pthread_cond_broadcast result %d for handle %p", thr_ret, handle);
g_assert (thr_ret == 0);
} else {
thr_ret = pthread_cond_signal (&handle_data->signal_cond);
+ if (thr_ret != 0)
+ g_warning ("Bad call to pthread_cond_signal result %d for handle %p", thr_ret, handle);
g_assert (thr_ret == 0);
}
/* Tell everyone blocking on multiple handles that something
* was signalled
- */
- pthread_cleanup_push ((void(*)(void *))mono_mutex_unlock_in_cleanup, (void *)_wapi_global_signal_mutex);
- thr_ret = mono_mutex_lock (_wapi_global_signal_mutex);
- g_assert (thr_ret == 0);
-
+ */
thr_ret = pthread_cond_broadcast (_wapi_global_signal_cond);
+ if (thr_ret != 0)
+ g_warning ("Bad call to pthread_cond_broadcast result %d for handle %p", thr_ret, handle);
g_assert (thr_ret == 0);
thr_ret = mono_mutex_unlock (_wapi_global_signal_mutex);
+ if (thr_ret != 0)
+ g_warning ("Bad call to mono_mutex_unlock result %d for global signal mutex", thr_ret);
g_assert (thr_ret == 0);
+
pthread_cleanup_pop (0);
} else {
handle_data->signalled=state;