Created
April 3, 2019 10:06
-
-
Save JustasMasiulis/64b713cd85d50b190f0d348fea1462a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int64_t MiSetPfnTbFlushStamp(_MMPFN *pfn, char flushStamp, BOOL pfnLocked) | |
{ | |
if(pfnLocked) | |
pfn->u2.TbFlushStamp = flushStamp; | |
else // CAS loop | |
while(true) { | |
auto old = pfn->u2; | |
auto new = old; | |
new.TbFlushStamp = flushStamp; | |
if(_InterlockedCompareExchange(&pfn->u2.Lock, new.EntireField, old.EntireField) == old.EntireField) | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment