ObjFW  Diff

Differences From Artifact [ffa37b7f10]:

To Artifact [e3a63de0b8]:


177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
	if ((condition->event = CreateEvent(NULL, FALSE, 0, NULL)) == NULL)
		return NO;

	return YES;
#endif
}

#if defined(OF_HAVE_PTHREADS)
static OF_INLINE BOOL
#elif defined(_WIN32)
static BOOL
#endif
of_condition_wait(of_condition_t *condition, of_mutex_t *mutex)
{
#if defined(OF_HAVE_PTHREADS)
	return !pthread_cond_wait(condition, mutex);
#elif defined(_WIN32)
	if (!of_mutex_unlock(mutex))
		return NO;







<

<
<
<







177
178
179
180
181
182
183

184



185
186
187
188
189
190
191
	if ((condition->event = CreateEvent(NULL, FALSE, 0, NULL)) == NULL)
		return NO;

	return YES;
#endif
}


static OF_INLINE BOOL



of_condition_wait(of_condition_t *condition, of_mutex_t *mutex)
{
#if defined(OF_HAVE_PTHREADS)
	return !pthread_cond_wait(condition, mutex);
#elif defined(_WIN32)
	if (!of_mutex_unlock(mutex))
		return NO;
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
#if defined(OF_HAVE_PTHREADS)
	return !pthread_cond_signal(condition);
#elif defined(_WIN32)
	return SetEvent(condition->event);
#endif
}

#if defined(OF_HAVE_PTHREADS)
static OF_INLINE BOOL
#elif defined(_WIN32)
static BOOL
#endif
of_condition_broadcast(of_condition_t *condition)
{
#if defined(OF_HAVE_PTHREADS)
	return !pthread_cond_broadcast(condition);
#elif defined(_WIN32)
	size_t i;

	for (i = 0; i < condition->count; i++)
		if (!SetEvent(condition->event))
			return NO;

	return YES;
#endif
}

#if defined(OF_HAVE_PTHREADS)
static OF_INLINE BOOL
#elif defined(_WIN32)
static BOOL
#endif
of_condition_free(of_condition_t *condition)
{
#if defined(OF_HAVE_PTHREADS)
	return !pthread_cond_destroy(condition);
#elif defined(_WIN32)
	if (condition->count)
		return NO;







<

<
<
<















<

<
<
<







212
213
214
215
216
217
218

219



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234

235



236
237
238
239
240
241
242
#if defined(OF_HAVE_PTHREADS)
	return !pthread_cond_signal(condition);
#elif defined(_WIN32)
	return SetEvent(condition->event);
#endif
}


static OF_INLINE BOOL



of_condition_broadcast(of_condition_t *condition)
{
#if defined(OF_HAVE_PTHREADS)
	return !pthread_cond_broadcast(condition);
#elif defined(_WIN32)
	size_t i;

	for (i = 0; i < condition->count; i++)
		if (!SetEvent(condition->event))
			return NO;

	return YES;
#endif
}


static OF_INLINE BOOL



of_condition_free(of_condition_t *condition)
{
#if defined(OF_HAVE_PTHREADS)
	return !pthread_cond_destroy(condition);
#elif defined(_WIN32)
	if (condition->count)
		return NO;