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 13
13
#include "PlatformMutex.h"
14
14
#include <stdlib.h>
15
15
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
16
23
#if defined(__APPLE__ )
17
24
#include <os/lock.h>
18
25
@@ -81,5 +88,20 @@ void swiftsyntax_platform_mutex_destroy(PlatformMutex m) {
81
88
}
82
89
83
90
#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.
85
93
#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