Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Sources/NIOEmbedded/AsyncTestingEventLoop.swift
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ public final class NIOAsyncTestingEventLoop: EventLoop, @unchecked Sendable {
task: {
do {
// UnsafeUnchecked is acceptable because we know we're in the loop here.
promise?.assumeIsolatedUnsafeUnchecked().succeed(try task())
let result = try task()
promise?.assumeIsolatedUnsafeUnchecked().succeed(result)
} catch let err {
promise?.fail(err)
}
Expand Down
4 changes: 3 additions & 1 deletion Tests/NIOPosixTests/EventLoopFutureIsolatedTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,15 @@ final class EventLoopFutureIsolatedTest: XCTestCase {
func _eventLoopIsolated(loop: any EventLoop) throws {
let f = loop.flatSubmit {
let value = SuperNotSendable()
value.x = 4

// Again, all of these need to close over value. In addition,
// many need to return it as well.
let isolated = loop.assumeIsolated()
XCTAssertIdentical(isolated.nonisolated(), loop)
isolated.execute {
XCTAssertEqual(value.x, 5)
XCTAssertEqual(value.x, 4)
value.x = 5
}
let firstFuture = isolated.submit {
let val = SuperNotSendable()
Expand Down
Loading