Skip to content

Commit

Permalink
NIOPosix on Darwin: inherit main thread QoS
Browse files Browse the repository at this point in the history
  • Loading branch information
weissi committed Oct 23, 2024
1 parent be823e6 commit 85c2e08
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Sources/NIOPosix/ThreadPosix.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ private func sysPthread_create(
args: UnsafeMutableRawPointer?
) -> CInt {
#if canImport(Darwin)
return pthread_create(handle, nil, destructor, args)
var attr: pthread_attr_t = .init()
pthread_attr_init(&attr)
pthread_attr_set_qos_class_np(&attr, qos_class_main(), 0)
let thread = pthread_create(handle, &attr, destructor, args)
pthread_attr_destroy(&attr)
return thread
#else
#if canImport(Musl)
var handleLinux: OpaquePointer? = nil
Expand Down

0 comments on commit 85c2e08

Please sign in to comment.