apple/swift-nio

NIOLoopBound should get `unchecked` variants that are truly free in release mode

Open

#2.506 geöffnet am 17. Aug. 2023

Auf GitHub ansehen
 (5 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Swift (749 Forks)batch import
good first issuekind/enhancement

Repository-Metriken

Stars
 (8.453 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 8T 5h) (18 gemergte PRs in 30 T)

Beschreibung

NIOLoopBound(Box) is super useful when adopting Sendable but the eventLoop.preconditionInEventLoop() checks everywhere are expensive and -- for repeated accesses -- unnecessary.

There should be unchecked variants of init, get and set value that do eventLoop.assertInEventLoop() instead. Together with @inlinable that should become completely free in release mode (and still check in debug).

Docs:

Contributor Guide