-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Thread sleep/wakeup (#31510 updated) #32029
Conversation
2fa1969
to
604668c
Compare
base/task.jl
Outdated
@@ -184,6 +184,7 @@ end | |||
|
|||
# NOTE: you can only wait for scheduled tasks | |||
function wait(t::Task) | |||
t === current_task() && error("deadlock detected") |
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.
t === current_task() && error("deadlock detected") | |
t === current_task() && error("Possible deadlock detected: Cannot wait on current task") |
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.
Since it's certain deadlock, saying "possible" seems odd
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.
I was thinking about user-error, where someone literally does wait(current_task())
. But in the end I only care that it is clear which action is not allowed.
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.
Yes, I ran into this because I did foreach(wait, tasks)
, then corrupted a huge amount of memory (basically, I just dropped all GC roots) which put current_task into tasks.
In full assertion mode, we could even expand this to check that donenotify
forms a DAG, this just constitutes a simple (e.g. inexpensive) subset of the general case. I think other systems do something similar to that, but on a timer?
604668c
to
78017b7
Compare
b917c98
to
204c29a
Compare
991ab79
to
0c6cac8
Compare
OK I think this is ready to merge. |
0c6cac8
to
52d7c18
Compare
52d7c18
to
93e3d28
Compare
This works towards integrating partr scheduler more closely with Julia.