Skip to content
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

Add Thread.new yields itself #14543

Merged

Conversation

ysbaddaden
Copy link
Contributor

Allows to interact with the thread object immediately, without having to reach for Thread.current. For example:

Thread.new do |thread|
  scheduler = Scheduler.new(thread)
  thread.current_scheduler = scheduler
end

A tiny sugar coat over an internal feature, but it's nice.

Allows to interact with the thread object immediately, without having to
reach for `Thread.current`. For example:

```
Thread.new do |thread|
  scheduler = Scheduler.new(thread)
  thread.current_scheduler = scheduler
end
```
@straight-shoota straight-shoota added this to the 1.13.0 milestone Apr 26, 2024
@straight-shoota straight-shoota changed the title Thread.new yields itself Add Thread.new yields itself Apr 28, 2024
@straight-shoota straight-shoota merged commit a726bf7 into crystal-lang:master Apr 28, 2024
60 checks passed
@ysbaddaden ysbaddaden deleted the feature/thread-new-yields-self branch April 30, 2024 16:29
ysbaddaden added a commit to ysbaddaden/execution_context that referenced this pull request Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants