mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-01-09 13:53:58 +00:00
[common] linux: stop event signals accumulating after they are serviced
This commit is contained in:
parent
fb9cf6cfbc
commit
f85b6418b8
1 changed files with 4 additions and 3 deletions
|
@ -87,10 +87,11 @@ bool lgWaitEventAbs(LGEvent * handle, struct timespec * ts)
|
||||||
{
|
{
|
||||||
assert(handle);
|
assert(handle);
|
||||||
|
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
int count = 0;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
while(ret && atomic_load(&handle->count) == 0)
|
while(ret && (count = atomic_load(&handle->count)) == 0)
|
||||||
{
|
{
|
||||||
if (pthread_mutex_lock(&handle->mutex) != 0)
|
if (pthread_mutex_lock(&handle->mutex) != 0)
|
||||||
{
|
{
|
||||||
|
@ -132,7 +133,7 @@ bool lgWaitEventAbs(LGEvent * handle, struct timespec * ts)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret && handle->autoReset)
|
if (ret && handle->autoReset)
|
||||||
atomic_fetch_sub(&handle->count, 1);
|
atomic_fetch_sub(&handle->count, count);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue