Created
September 30, 2011 20:43
-
-
Save Nub/1254920 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| static void *volatile _dlManagerInstance = nil; | |
| + (DownloadManager *) sharedInstance { | |
| while (!_dlManagerInstance) { | |
| DownloadManager *temp = [[self alloc] init]; | |
| if(!OSAtomicCompareAndSwapPtrBarrier(0x0, temp, &_dlManagerInstance)) { | |
| [temp release]; | |
| } | |
| } | |
| return _dlManagerInstance; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment