apple/swift-nio

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

Open

#2506 aperta il 17 ago 2023

Vedi su GitHub
 (5 commenti) (0 reazioni) (0 assegnatari)Swift (749 fork)batch import
good first issuekind/enhancement

Metriche repository

Star
 (8453 star)
Metriche merge PR
 (Merge medio 8g 5h) (18 PR mergiate in 30 g)

Descrizione

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:

Guida contributor