示例#1
0
文件: wait.c 项目: 0ostreamo0/mono
static gboolean test_and_own (guint32 numobjects, gpointer *handles,
			      gboolean waitall, guint32 *count,
			      guint32 *lowest)
{
	gboolean done;
	int i;
	
	MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: locking handles", __func__);
	
	done = _wapi_handle_count_signalled_handles (numobjects, handles,
						     waitall, count, lowest);
	if (done == TRUE) {
		if (waitall == TRUE) {
			for (i = 0; i < numobjects; i++) {
				own_if_signalled (handles[i]);
			}
		} else {
			own_if_signalled (handles[*lowest]);
		}
	}
	
	MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking handles", __func__);

	_wapi_handle_unlock_handles (numobjects, handles);

	return(done);
}
示例#2
0
static void handle_cleanup (void *data)
{
	struct handle_cleanup_data *handles = (struct handle_cleanup_data *)data;

	_wapi_handle_unlock_handles (handles->numobjects, handles->handles);
}