Created
October 19, 2012 10:10
-
-
Save yfrancis/3917300 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
void | |
WSRelease(WSTypeRef obj) | |
{ | |
WSIndex orig = obj->retainCount; | |
while (!OSAtomicDecrement32Barrier((int32_t*)&obj->retainCount)); | |
if (orig == 1 && !obj->retainCount) | |
free(obj); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
int32_t newCount = OSAtomicDecrement32Barrier((int32_t*)&obj->retainCount));
if (!newCount) {
free(obj);
}