aboutsummaryrefslogtreecommitdiffstats
path: root/common/threads.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/threads.c')
-rw-r--r--common/threads.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/common/threads.c b/common/threads.c
index d9c32267..cd9f6755 100644
--- a/common/threads.c
+++ b/common/threads.c
@@ -341,15 +341,15 @@ int alcnd_broadcast(alcnd_t *cond)
int alcnd_wait(alcnd_t *cond, almtx_t *mtx)
{
_int_alcnd_t *icond = cond->Ptr;
- int res, last;
+ int res;
IncrementRef(&icond->wait_count);
LeaveCriticalSection(mtx);
res = WaitForMultipleObjects(2, icond->events, FALSE, INFINITE);
- last = DecrementRef(&icond->wait_count) == 0 && res == WAIT_OBJECT_0+BROADCAST;
- if(last) ResetEvent(icond->events[BROADCAST]);
+ if(DecrementRef(&icond->wait_count) == 0 && res == WAIT_OBJECT_0+BROADCAST)
+ ResetEvent(icond->events[BROADCAST]);
EnterCriticalSection(mtx);
return althrd_success;
@@ -360,7 +360,7 @@ int alcnd_timedwait(alcnd_t *cond, almtx_t *mtx, const struct timespec *time_poi
_int_alcnd_t *icond = cond->Ptr;
struct timespec curtime;
DWORD sleeptime;
- int res, last;
+ int res;
if(altimespec_get(&curtime, AL_TIME_UTC) != AL_TIME_UTC)
return althrd_error;
@@ -372,8 +372,8 @@ int alcnd_timedwait(alcnd_t *cond, almtx_t *mtx, const struct timespec *time_poi
res = WaitForMultipleObjects(2, icond->events, FALSE, sleeptime);
- last = DecrementRef(&icond->wait_count) == 0 && res == WAIT_OBJECT_0+BROADCAST;
- if(last) ResetEvent(icond->events[BROADCAST]);
+ if(DecrementRef(&icond->wait_count) == 0 && res == WAIT_OBJECT_0+BROADCAST)
+ ResetEvent(icond->events[BROADCAST]);
EnterCriticalSection(mtx);
return (res == WAIT_TIMEOUT) ? althrd_timedout : althrd_success;