Skip to content

Commit cfc4413

Browse files
committed
PlugIn: don't use POSIX locking on Windows
Windows is not a POSIX environment and does not provide POSIX threads.
1 parent 6456773 commit cfc4413

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

CoreFoundation/PlugIn.subproj/CFBundle.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,10 @@ static void __CFBundleDeallocate(CFTypeRef cf) {
626626
if (bundle->_resourceDirectoryContents) CFRelease(bundle->_resourceDirectoryContents);
627627

628628
if (bundle->_additionalResourceBundles) CFRelease(bundle->_additionalResourceBundles);
629-
629+
630+
#if _POSIX_THREADS
630631
pthread_mutex_destroy(&(bundle->_bundleLoadingLock));
632+
#endif
631633
}
632634

633635
const CFRuntimeClass __CFBundleClass = {
@@ -777,6 +779,7 @@ static CFBundleRef _CFBundleCreate(CFAllocatorRef allocator, CFURLRef bundleURL,
777779
bundle->_plugInData._registeredFactory = false;
778780
bundle->_plugInData._factories = NULL;
779781

782+
#if _POSIX_THREADS
780783
pthread_mutexattr_t mattr;
781784
pthread_mutexattr_init(&mattr);
782785
pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_DEFAULT);
@@ -785,6 +788,9 @@ static CFBundleRef _CFBundleCreate(CFAllocatorRef allocator, CFURLRef bundleURL,
785788
if (0 != mret) {
786789
CFLog(4, CFSTR("%s: failed to initialize bundle loading lock for bundle %@."), __PRETTY_FUNCTION__, bundle);
787790
}
791+
#elif DEPLOYMENT_TARGET_WINDOWS
792+
bundle->_bundleLoadingLock = CFLockInit;
793+
#endif
788794

789795
bundle->_lock = CFLockInit;
790796
bundle->_resourceDirectoryContents = NULL;

0 commit comments

Comments
 (0)