File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
Sources/_SwiftSyntaxCShims Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change 1313#include "PlatformMutex.h"
1414#include <stdlib.h>
1515
16+ #if defined(__wasi__ ) && !defined(_REENTRANT )
17+ #define SWIFTSYNTAX_HAS_THREAD 0
18+ #else
19+ #define SWIFTSYNTAX_HAS_THREAD 1
20+ #endif
21+
22+ #if SWIFTSYNTAX_HAS_THREAD
1623#if defined(__APPLE__ )
1724#include <os/lock.h>
1825
@@ -81,5 +88,20 @@ void swiftsyntax_platform_mutex_destroy(PlatformMutex m) {
8188}
8289
8390#else
84- #error "platfrom mutex implementation is not available"
91+ #error "platform mutex implementation is not available"
92+ // Add platform specific implementation above, or set SWIFTSYNTAX_HAS_THREAD to 0.
8593#endif
94+
95+ #else // SWIFTSYNTAX_HAS_THREAD
96+
97+ PlatformMutex swiftsyntax_platform_mutex_create () {
98+ PlatformMutex m ;
99+ m .opaque = 0 ;
100+ return m ;
101+ }
102+
103+ void swiftsyntax_platform_mutex_lock (PlatformMutex m ) {}
104+ void swiftsyntax_platform_mutex_unlock (PlatformMutex m ) {}
105+ void swiftsyntax_platform_mutex_destroy (PlatformMutex m ) {}
106+
107+ #endif // SWIFTSYNTAX_HAS_THREAD
You can’t perform that action at this time.
0 commit comments