Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/minhook.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTsuda Kageyu <tsuda.kageyu@gmail.com>2015-08-18 04:59:24 +0300
committerTsuda Kageyu <tsuda.kageyu@gmail.com>2015-08-18 04:59:24 +0300
commitb52a484dc67c069b3a074969b29ff3508c38991e (patch)
tree0a846a16b26e71dcbe967bfb742d773869de08cf
parent1bab4997916d761d5a61c2cc4e568f3bbb4b4ed9 (diff)
Add some supplementary comments.
-rw-r--r--src/hook.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/hook.c b/src/hook.c
index 5f10c34..0b58897 100644
--- a/src/hook.c
+++ b/src/hook.c
@@ -442,6 +442,9 @@ static VOID EnterSpinLock(VOID)
// Wait until the flag is FALSE.
while (InterlockedCompareExchange(&g_isLocked, TRUE, FALSE) != FALSE)
{
+ // No need to generate a memory barrier here, since InterlockedCompareExchange()
+ // generates a full memory barrier itself.
+
// Prevent the loop from being too busy.
if (spinCount < 32)
Sleep(0);
@@ -455,6 +458,9 @@ static VOID EnterSpinLock(VOID)
//-------------------------------------------------------------------------
static VOID LeaveSpinLock(VOID)
{
+ // No need to generate a memory barrier here, since InterlockedExchange()
+ // generates a full memory barrier itself.
+
InterlockedExchange(&g_isLocked, FALSE);
}