apple/swift-corelibs-libdispatch

Add `Sendable` conformances to thread-safe types

fumoboy007 opened this issue · 1 comments

All or almost all of Dispatch’s types are thread-safe, so they should be marked as Sendable.

mman commented

There is this weird state in Swift 5.10 where on Linux usage of Dispatch with StrictConcurrencyChecking enabled generates these nonsensical errors that do not exist on macOS.

For example:

main.swift:131:31: warning: passing argument of non-sendable type 'DispatchQueue' outside of main actor-isolated context may introduce data races
        try await host.start(queue: queue)
                              ^
Dispatch.DispatchQueue:1:14: note: class 'DispatchQueue' does not conform to the 'Sendable' protocol
public class DispatchQueue : DispatchObject {
             ^
main.swift:2:1: remark: add '@preconcurrency' to suppress 'Sendable'-related warnings from module 'Dispatch'
import Dispatch
^

This needs fixing...