aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-07-05 13:56:57 +0000
committerJason A. Donenfeld <Jason@zx2c4.com>2019-07-05 13:56:57 +0000
commit20586e37b22379c8991cdd4dc00e8bce5078c725 (patch)
tree4ebe2506730fbc745d4e301938d32a6f08ca562b
parentCleanup atomic getters (diff)
downloadwintun-20586e37b22379c8991cdd4dc00e8bce5078c725.tar.xz
wintun-20586e37b22379c8991cdd4dc00e8bce5078c725.zip
Treat ReferenceCount as an atomic
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--wintun.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/wintun.c b/wintun.c
index 8ec2090..698914b 100644
--- a/wintun.c
+++ b/wintun.c
@@ -1467,7 +1467,7 @@ TunWaitForReferencesToDropToZero(_In_ DEVICE_OBJECT *DeviceObject)
MaxTries = TotalTime / SleepTime
};
#pragma warning(suppress : 28175)
- for (int Try = 0; Try < MaxTries && DeviceObject->ReferenceCount; ++Try)
+ for (INT Try = 0; Try < MaxTries && InterlockedGet(&DeviceObject->ReferenceCount); ++Try)
NdisMSleep(SleepTime);
}