Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions Source/CFTimeZone.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,13 @@ CFTimeZoneCreate (CFAllocatorRef alloc, CFStringRef name, CFDataRef data)
struct __CFTimeZone *new;
CFTimeZoneRef old;

GSMutexLock(&_kCFTimeZoneCacheLock);
if (_kCFTimeZoneCache == NULL)
{
GSMutexLock(&_kCFTimeZoneCacheLock);
/* Double check the cache is still NULL. */
if (_kCFTimeZoneCache == NULL)
_kCFTimeZoneCache = CFDictionaryCreateMutable (
kCFAllocatorSystemDefault, 0,
&kCFCopyStringDictionaryKeyCallBacks, NULL);
GSMutexUnlock(&_kCFTimeZoneCacheLock);
}
/* Verify we haven't created a timezone with this name already. */
_kCFTimeZoneCache = CFDictionaryCreateMutable (
kCFAllocatorSystemDefault, 0,
&kCFCopyStringDictionaryKeyCallBacks, NULL);
old = (CFTimeZoneRef)CFDictionaryGetValue (_kCFTimeZoneCache, name);
GSMutexUnlock(&_kCFTimeZoneCacheLock);
if (old != NULL)
return CFRetain (old);

Expand Down