Skip to content

Commit 86110b2

Browse files
authored
add message: parameter
1 parent 5eeff6f commit 86110b2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

proposals/NNNN-advanced-isolation-checking-for-serialexecutor.md renamed to proposals/NNNN-advanced-custom-isolation-checking-for-serialexecutor.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Advanced isolation checking for SerialExecutor
1+
# Advanced custom isolation checking for SerialExecutor
22

3-
* Proposal: [SE-NNNN](NNNN-advanced-isolation-checking-for-serialexecutor.md)
3+
* Proposal: [SE-NNNN](NNNN-advanced-custom-isolation-checking-for-serialexecutor.md)
44
* Author: [Konrad 'ktoso' Malawski](https://github.com/ktoso)
55
* Review Manager: ???
66
* Status: **Work in Progress**
@@ -113,7 +113,7 @@ Specific use-cases of this API include `DispatchSerialQueue`, which would be abl
113113
// Dispatch
114114

115115
extension DispatchSerialQueue {
116-
public func checkIsolated() {
116+
public func checkIsolated(message: String) {
117117
dispatchPrecondition(condition: .onQueue(self)) // existing Dispatch API
118118
}
119119
}
@@ -131,7 +131,9 @@ This means that the following code snippet, while a bit unusual remains correct
131131
actor Worker {
132132
var number: Int
133133

134-
nonisolated func canOnlyCallMeWhileIsolatedOnThisInstance() -> Int {
134+
nonisolated func canOnlyCallMeWhileIsolatedOnThisInstance() -> Int {
135+
self.preconditionIsolated("This method must be called while isolated to \(self)")
136+
135137
return self.assumeIsolated { // () throws -> Int
136138
// suspensions are not allowed in this closure.
137139

@@ -168,7 +170,7 @@ The custom heurystics that are today part of the Swift Concurrency runtime to de
168170
```swift
169171
// concurrency runtime pseudo-code
170172
if expectedExecutor.isMainActor() {
171-
globalMainActor.checkIsolated()
173+
expectedExecutor.checkIsolated(message: message)
172174
}
173175
```
174176

0 commit comments

Comments
 (0)