Skip to content

Commit 439dd0d

Browse files
committed
Base: define os_unfair_lock as CFLock_t
On Windows, `CFLock_t` is already an unfair lock. Simply add some macros to use `CFLock_t` on Windows as it is not as lightweight on Darwin.
1 parent 2771280 commit 439dd0d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

CoreFoundation/Base.subproj/CFInternal.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,11 @@ typedef pthread_mutex_t os_unfair_lock;
585585
typedef pthread_mutex_t * os_unfair_lock_t;
586586
static void os_unfair_lock_lock(os_unfair_lock_t lock) { pthread_mutex_lock(lock); }
587587
static void os_unfair_lock_unlock(os_unfair_lock_t lock) { pthread_mutex_unlock(lock); }
588+
#elif defined(_WIN32)
589+
#define OS_UNFAIR_LOCK_INIT CFLockInit
590+
#define os_unfair_lock CFLock_t
591+
#define os_unfair_lock_lock __CFLock
592+
#define os_unfair_lock_unlock __CFUnlock
588593
#endif // __has_include(<os/lock.h>)
589594

590595
#if !__HAS_DISPATCH__

0 commit comments

Comments
 (0)