Skip to content

Commit 92ec247

Browse files
authored
Merge pull request #2491 from mattmassicotte/patch-6
fix syntax for example
2 parents 0268b93 + 4ad5f37 commit 92ec247

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

proposals/0424-custom-isolation-checking-for-serialexecutor.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The following example demonstrates such a situation:
2222
import Dispatch
2323

2424
actor Caplin {
25-
let queue: DispatchSerialQueue(label: "CoolQueue")
25+
let queue: DispatchSerialQueue = .init(label: "CoolQueue")
2626

2727
var num: Int // actor isolated state
2828

@@ -35,9 +35,9 @@ actor Caplin {
3535
queue.async {
3636
// guaranteed to execute on `queue`
3737
// which is the same as self's serial executor
38-
queue.assertIsolated() // CRASH: Incorrect actor executor assumption
39-
self.assumeIsolated { // CRASH: Incorrect actor executor assumption
40-
num += 1
38+
self.queue.assertIsolated() // CRASH: Incorrect actor executor assumption
39+
self.assumeIsolated { caplin in // CRASH: Incorrect actor executor assumption
40+
caplin.num += 1
4141
}
4242
}
4343
}

0 commit comments

Comments
 (0)