From adb12bfcccaa040778c905c5a50da9d9367fd0db Mon Sep 17 00:00:00 2001 From: 0xpablo Date: Sat, 24 Jun 2023 00:54:35 +0200 Subject: [PATCH] Add WebAssembly support (#273) --- Sources/AsyncAlgorithms/Locking.swift | 2 ++ Sources/AsyncSequenceValidation/TaskDriver.swift | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/Sources/AsyncAlgorithms/Locking.swift b/Sources/AsyncAlgorithms/Locking.swift index 4e8e246c..e1ed2626 100644 --- a/Sources/AsyncAlgorithms/Locking.swift +++ b/Sources/AsyncAlgorithms/Locking.swift @@ -24,6 +24,8 @@ internal struct Lock { typealias Primitive = pthread_mutex_t #elseif canImport(WinSDK) typealias Primitive = SRWLOCK +#else + typealias Primitive = Int #endif typealias PlatformLock = UnsafeMutablePointer diff --git a/Sources/AsyncSequenceValidation/TaskDriver.swift b/Sources/AsyncSequenceValidation/TaskDriver.swift index 9f45c1f6..69c8fe5c 100644 --- a/Sources/AsyncSequenceValidation/TaskDriver.swift +++ b/Sources/AsyncSequenceValidation/TaskDriver.swift @@ -50,8 +50,12 @@ final class TaskDriver { } func start() { +#if canImport(Darwin) || canImport(Glibc) pthread_create(&thread, nil, start_thread, Unmanaged.passRetained(self).toOpaque()) +#elseif canImport(WinSDK) +#error("TODO: Port TaskDriver threading to windows") +#endif } func run() {