-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Improve docs for Fiber::ExecutionContext
#16602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
straight-shoota
merged 6 commits into
crystal-lang:master
from
ysbaddaden:docs/improve-execution-context
Mar 14, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7261102
Improve docs for Fiber::ExecutionContext
ysbaddaden 91794f2
Fix: tiny sentence improvement
ysbaddaden 999cdcc
Explicit relationship with system threads (what to (not) expect)
ysbaddaden 92f80ad
Drop Parallel#size + improve docs for #capacity
ysbaddaden 1aeede9
Fix: we need #size so let's make it internal
ysbaddaden 26e8152
Fix: nodoc Parallel#size
ysbaddaden File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: I'm wondering if
Isolatedshould perhaps work without thread pool. So we would guarantee that an isolated context always runs in a fresh system thread and that thread won't be reused afterwards. This might be a useful property for libraries that integrate deeply with the system thread. It would implicitly allow changing the threads properties without the risk of affecting other code that might reuse the thread afterwards.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But detrimental to libraries that regularly spawn isolated fibers 🤷
I can see an application configuring the scheduler, cpu affinity or sigaltstack, but it it likely for a library to do that without resetting it afterwards? Shouldn't it just keep running there (like a GUI main loop)?
I'm searching what Go does (threads always return to the pool) and I can't find anything. I guess it expects any customization to be reset by the app/lib or to never return it.
(Now, we shall eventually have means to configure a context (cpu affinity, ...), attaching a scheduler shall set them, and returning the thread to the pool shall reset them back to their defaults.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was just a thought about a theoretical issue. I don't have any particular use case in mind. Thanks for clarifying. 👍
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a valid concern and needs discussing.
I think it applies to the thread pool in general: every thread will return to the pool and that will happen at any time, and there's no use control over it. We should start designing standard mechanisms to set cpu affinity and other attributes (for the whole process, or to a specific context), so we can set/reset them as needed. Maybe customizable hooks on checkin/out, too?