This repairs the build on Windows after the thread implementation was split out.
This commit is contained in:
parent
51238f4df8
commit
ffb196f544
|
@ -132,11 +132,11 @@ enum ThreadOpsPosix: ThreadOps {
|
||||||
precondition(result == 0, "pthread_key_delete failed: \(result)")
|
precondition(result == 0, "pthread_key_delete failed: \(result)")
|
||||||
}
|
}
|
||||||
|
|
||||||
static func getThreadSpecificValue(_ key: pthread_key_t) -> UnsafeMutableRawPointer? {
|
static func getThreadSpecificValue(_ key: ThreadSpecificKey) -> UnsafeMutableRawPointer? {
|
||||||
return pthread_getspecific(key)
|
return pthread_getspecific(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
static func setThreadSpecificValue(key: pthread_key_t, value: UnsafeMutableRawPointer?) {
|
static func setThreadSpecificValue(key: ThreadSpecificKey, value: UnsafeMutableRawPointer?) {
|
||||||
let result = pthread_setspecific(key, value)
|
let result = pthread_setspecific(key, value)
|
||||||
precondition(result == 0, "pthread_setspecific failed: \(result)")
|
precondition(result == 0, "pthread_setspecific failed: \(result)")
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ enum ThreadOpsWindows: ThreadOps {
|
||||||
|
|
||||||
// FIXME(compnerd) this should use the `stdcall` calling convention
|
// FIXME(compnerd) this should use the `stdcall` calling convention
|
||||||
let routine: @convention(c) (UnsafeMutableRawPointer?) -> CUnsignedInt = {
|
let routine: @convention(c) (UnsafeMutableRawPointer?) -> CUnsignedInt = {
|
||||||
let boxed = Unmanaged<ThreadBox>.fromOpaque($0!).takeRetainedValue()
|
let boxed = Unmanaged<NIOThread.ThreadBox>.fromOpaque($0!).takeRetainedValue()
|
||||||
let (body, name) = (boxed.value.body, boxed.value.name)
|
let (body, name) = (boxed.value.body, boxed.value.name)
|
||||||
let hThread: ThreadOpsSystem.ThreadHandle = GetCurrentThread()
|
let hThread: ThreadOpsSystem.ThreadHandle = GetCurrentThread()
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ enum ThreadOpsWindows: ThreadOps {
|
||||||
assert(dwResult == WAIT_OBJECT_0, "WaitForSingleObject: \(GetLastError())")
|
assert(dwResult == WAIT_OBJECT_0, "WaitForSingleObject: \(GetLastError())")
|
||||||
}
|
}
|
||||||
|
|
||||||
static func allocateThreadSpecificValue(destructor: ThreadSpecificKeyDestructor) -> ThreadSpecificKey {
|
static func allocateThreadSpecificValue(destructor: @escaping ThreadSpecificKeyDestructor) -> ThreadSpecificKey {
|
||||||
return FlsAlloc(destructor)
|
return FlsAlloc(destructor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,11 +81,11 @@ enum ThreadOpsWindows: ThreadOps {
|
||||||
precondition(dwResult, "FlsFree: \(GetLastError())")
|
precondition(dwResult, "FlsFree: \(GetLastError())")
|
||||||
}
|
}
|
||||||
|
|
||||||
static func getThreadSpecificValue(_ key: pthread_key_t) -> UnsafeMutableRawPointer? {
|
static func getThreadSpecificValue(_ key: ThreadSpecificKey) -> UnsafeMutableRawPointer? {
|
||||||
return FlsGetValue(key.value)
|
return FlsGetValue(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
static func setThreadSpecificValue(key: pthread_key_t, value: UnsafeMutableRawPointer?) {
|
static func setThreadSpecificValue(key: ThreadSpecificKey, value: UnsafeMutableRawPointer?) {
|
||||||
FlsSetValue(key, value)
|
FlsSetValue(key, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue