-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
81 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# 5. Application errors | ||
# 6. Actors | ||
|
||
Date: 2024-03-26 | ||
|
||
|
27 changes: 27 additions & 0 deletions
27
generated-doc/out/adr/0007-supervised-unsupervised-scopes.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# 7. Supervised & unsupervised scopes | ||
|
||
Date: 2024-04-17 | ||
|
||
## Context | ||
|
||
Originally, ox had only `scoped` which created non-supervised scopes, that is errors were only discovered via explicit | ||
joining. This was later changed by introducing `supervised` and `unsupervised` scopes, where the former would end | ||
immediately when any fork failed, and the latter would not. However, `supervised` scopes have an overhead: they create | ||
an additional fork, in which the scope's main body is run. Is it possible to avoid this extra fork? | ||
|
||
## Decision | ||
|
||
In short: no. | ||
|
||
An alternate design would be to store the thread, that created the scope as part of the supervisor, and when any | ||
exception occurs, interrupt that thread so that it would discover the exception. However, this would be prone to | ||
interruption-races with external interruptions of that main thread. Even if we included an additional flag, specifying | ||
if the interruption happened because the scope ends, it would still be possible for an external interrupt to go | ||
unnoticed (if it happened at the same time, as the internal one). Even though unlikely, such a design would be fragile, | ||
hence we are keeping the current implementation. | ||
|
||
## Consequences | ||
|
||
To make our design more type-safe, we split the `Ox` capability into `OxPlain` (allowing only unsupervised forks), and | ||
`Ox`. The `plain` nomeclature was chosen to indicate that the scope is unsupervised, however `forkPlain` is much shorter | ||
than e.g. `forkUnsupervised`. Hence introducing a new name seems justified. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters