summaryrefslogtreecommitdiffstats
path: root/winpr/libwinpr/utils/collections/CountdownEvent.c
diff options
context:
space:
mode:
Diffstat (limited to 'winpr/libwinpr/utils/collections/CountdownEvent.c')
-rw-r--r--winpr/libwinpr/utils/collections/CountdownEvent.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/winpr/libwinpr/utils/collections/CountdownEvent.c b/winpr/libwinpr/utils/collections/CountdownEvent.c
index fd23e0c..771ba54 100644
--- a/winpr/libwinpr/utils/collections/CountdownEvent.c
+++ b/winpr/libwinpr/utils/collections/CountdownEvent.c
@@ -48,7 +48,10 @@ struct CountdownEvent
size_t CountdownEvent_CurrentCount(wCountdownEvent* countdown)
{
WINPR_ASSERT(countdown);
- return countdown->count;
+ EnterCriticalSection(&countdown->lock);
+ const size_t rc = countdown->count;
+ LeaveCriticalSection(&countdown->lock);
+ return rc;
}
/**
@@ -58,7 +61,10 @@ size_t CountdownEvent_CurrentCount(wCountdownEvent* countdown)
size_t CountdownEvent_InitialCount(wCountdownEvent* countdown)
{
WINPR_ASSERT(countdown);
- return countdown->initialCount;
+ EnterCriticalSection(&countdown->lock);
+ const size_t rc = countdown->initialCount;
+ LeaveCriticalSection(&countdown->lock);
+ return rc;
}
/**