mirror of
https://github.com/reactos/reactos.git
synced 2025-07-27 20:32:18 +00:00
[KERNEL32_APITEST] Use InterlockedIncrement for proper synchronization
This commit is contained in:
parent
43b181309e
commit
85fc290bb7
1 changed files with 4 additions and 4 deletions
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#define MAX_RECORD 30
|
#define MAX_RECORD 30
|
||||||
|
|
||||||
static DWORD s_record_count = 0;
|
static LONG s_record_count = 0;
|
||||||
static DWORD s_record[MAX_RECORD + 1] = { 0 };
|
static DWORD s_record[MAX_RECORD + 1] = { 0 };
|
||||||
static BOOL s_terminate_all = FALSE;
|
static BOOL s_terminate_all = FALSE;
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@ static const SIZE_T s_expected_count = _countof(s_expected);
|
||||||
|
|
||||||
static void AddValueToRecord(DWORD dwValue)
|
static void AddValueToRecord(DWORD dwValue)
|
||||||
{
|
{
|
||||||
s_record[s_record_count] = dwValue;
|
LONG next = InterlockedIncrement(&s_record_count) - 1;
|
||||||
if (s_record_count < MAX_RECORD)
|
if (next < MAX_RECORD)
|
||||||
s_record_count++;
|
s_record[next] = dwValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID CheckRecord(void)
|
static VOID CheckRecord(void)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue