Skip to content

Commit 807e415

Browse files
authored
Merge pull request #2867 from apple/maxd/wasi-locking
2 parents d8cbc2a + acbecae commit 807e415

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

CoreFoundation/Base.subproj/CFLocking.h

+16
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,22 @@ typedef CFLock_t OSSpinLock;
9696
#define OSSpinLockLock(lock) __CFLock(lock)
9797
#define OSSpinLockUnlock(lock) __CFUnlock(lock)
9898

99+
#elif TARGET_OS_WASI
100+
101+
// Empty shims until https://bugs.swift.org/browse/SR-12097 is resolved.
102+
typedef int32_t CFLock_t;
103+
typedef CFLock_t OSSpinLock;
104+
#define CFLockInit 0
105+
#define CF_LOCK_INIT_FOR_STRUCTS(X) (X = CFLockInit)
106+
#define OS_SPINLOCK_INIT CFLockInit
107+
108+
#define OSSpinLockLock(lock) __CFLock(lock)
109+
#define OSSpinLockUnlock(lock) __CFUnlock(lock)
110+
#define __CFLock(A) do {} while (0)
111+
#define __CFUnlock(A) do {} while (0)
112+
113+
static inline CFLock_t __CFLockInit(void) { return CFLockInit; }
114+
99115
#else
100116

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

0 commit comments

Comments
 (0)