Thread: repair build on Windows after #1433 (#1434)

This repairs the build on Windows after the thread implementation was
split out.
This commit is contained in:
Johannes Weiss 2020-03-05 08:32:51 +00:00 committed by GitHub
parent 51238f4df8
commit ffb196f544
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -132,11 +132,11 @@ enum ThreadOpsPosix: ThreadOps {
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)
}
static func setThreadSpecificValue(key: pthread_key_t, value: UnsafeMutableRawPointer?) {
static func setThreadSpecificValue(key: ThreadSpecificKey, value: UnsafeMutableRawPointer?) {
let result = pthread_setspecific(key, value)
precondition(result == 0, "pthread_setspecific failed: \(result)")
}

View File

@ -37,7 +37,7 @@ enum ThreadOpsWindows: ThreadOps {
// FIXME(compnerd) this should use the `stdcall` calling convention
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 hThread: ThreadOpsSystem.ThreadHandle = GetCurrentThread()
@ -72,7 +72,7 @@ enum ThreadOpsWindows: ThreadOps {
assert(dwResult == WAIT_OBJECT_0, "WaitForSingleObject: \(GetLastError())")
}
static func allocateThreadSpecificValue(destructor: ThreadSpecificKeyDestructor) -> ThreadSpecificKey {
static func allocateThreadSpecificValue(destructor: @escaping ThreadSpecificKeyDestructor) -> ThreadSpecificKey {
return FlsAlloc(destructor)
}
@ -81,11 +81,11 @@ enum ThreadOpsWindows: ThreadOps {
precondition(dwResult, "FlsFree: \(GetLastError())")
}
static func getThreadSpecificValue(_ key: pthread_key_t) -> UnsafeMutableRawPointer? {
return FlsGetValue(key.value)
static func getThreadSpecificValue(_ key: ThreadSpecificKey) -> UnsafeMutableRawPointer? {
return FlsGetValue(key)
}
static func setThreadSpecificValue(key: pthread_key_t, value: UnsafeMutableRawPointer?) {
static func setThreadSpecificValue(key: ThreadSpecificKey, value: UnsafeMutableRawPointer?) {
FlsSetValue(key, value)
}