summaryrefslogtreecommitdiffstats
path: root/common/threads.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-05-27 15:32:38 -0700
committerChris Robinson <[email protected]>2014-05-27 15:32:38 -0700
commitfd62868c17ce1b7c0a68c6615c0392b09c3661cd (patch)
tree0e9fc7ec4a8722b6d21df0219f173e8533752223 /common/threads.c
parentf0b65aa6b7356bc926f0b5217676ec8575ef5d00 (diff)
Avoid unnecessary local variables
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;