apple / swift-nio-transport-services

Extensions for SwiftNIO to support Apple platforms as first-class citizens.
https://swiftpackageindex.com/apple/swift-nio-transport-services/main/documentation/niotransportservices
Apache License 2.0
286 stars 74 forks source link

Move check for event loop shutdown into taskQueue #127

Closed PeterAdams-A closed 3 years ago

PeterAdams-A commented 3 years ago

Motivation:

The event loop state is not protected for access on different threads. This means it must only be accessed from the task queue.

Modifications:

Move check for event loop shutdown into taskQueue

Result:

Event Loop state only accessed from the task queue.

PeterAdams-A commented 3 years ago

Also see rdar://82043918 It feels slightly counter intuitive to check if the EventLoop is shutdown from on the loop but I believe this is fine as the dispatch queue doesn't go away with shutdown. A similar pattern seems to be used elsewhere in this file too.

PeterAdams-A commented 3 years ago

Raised night build fail - https://bugs.swift.org/browse/SR-15090