objc2 icon indicating copy to clipboard operation
objc2 copied to clipboard

Are network-extension types safe to mark as Send/Sync?

Open roblabla opened this issue 8 months ago • 1 comments

Currently, all the types from objc2-network-extension are currently marked as !Send/!Sync. This is fairly inconvenient, and doesn't seem to be necessary? For instance, NEFilterFlow/NEFilterSocketFlow seem to just be data containers with no internal mutability, so there shouldn't be any problem in making them sharable across threads.

Is this wrong? And if it isn't, is there any plans to make those types Send/Sync?

roblabla avatar Apr 29 '25 16:04 roblabla

They aren't Send/Sync because they aren't Sendable in Swift either:

// swift -swift-version 6 foo.swift
import NetworkExtension

func make_sendable(flow: NEFilterFlow) -> Sendable {
    return flow // fails
}

We can fix this locally in objc2-network-extension (feel free to submit a PR, you mostly just need to add a file with the impls and reasoning), though I'd prefer if you submitted this directly to Apple through their Feedback Assistant or similar, I'd feel much more comfortable with making these types Send/Sync if Apple does so too.

madsmtm avatar Apr 29 '25 17:04 madsmtm