Skip to content
Merged
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
16 changes: 16 additions & 0 deletions CoreFoundation/Base.subproj/CFLocking.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,22 @@ typedef CFLock_t OSSpinLock;
#define OSSpinLockLock(lock) __CFLock(lock)
#define OSSpinLockUnlock(lock) __CFUnlock(lock)

#elif TARGET_OS_WASI

// Empty shims until https://bugs.swift.org/browse/SR-12097 is resolved.
typedef int32_t CFLock_t;
typedef CFLock_t OSSpinLock;
#define CFLockInit 0
#define CF_LOCK_INIT_FOR_STRUCTS(X) (X = CFLockInit)
#define OS_SPINLOCK_INIT CFLockInit

#define OSSpinLockLock(lock) __CFLock(lock)
#define OSSpinLockUnlock(lock) __CFUnlock(lock)
#define __CFLock(A) do {} while (0)
#define __CFUnlock(A) do {} while (0)

static inline CFLock_t __CFLockInit(void) { return CFLockInit; }

#else

#warning CF locks not defined for this platform -- CF is not thread-safe
Expand Down