-
-
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
Fix external IO loop thead interaction and add function to Base.Experimental to facilitate it's use. Also add a test. #55529
Conversation
…imental to facilitate it's use. Also add a test.
test/threads.jl
Outdated
|
||
""" | ||
proc = run(pipeline(`$(Base.julia_cmd()) -e $cmd`), wait=false) | ||
sleep(10) # Is there a better way to do this? |
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.
Per previous discussion, this test needs to be rewritten to remove the sleep call before merging. The most common alternative is to set up a watchdog call such as t = Timer(60) do t; kill(proc); end; success(proc); close(t)
Bump! |
Is there a reason we don't want a separate IO thread to be the default? It seems like a better design. |
@@ -423,6 +445,8 @@ JL_DLLEXPORT jl_gcframe_t **jl_adopt_thread(void) | |||
JL_GC_PROMISE_ROOTED(ct); | |||
uv_random(NULL, NULL, &ct->rngState, sizeof(ct->rngState), 0, NULL); | |||
jl_atomic_fetch_add(&jl_gc_disable_counter, -1); | |||
ct->world_age = jl_get_world_counter(); // root_task sets world_age to 1 | |||
jl_init_task_lock(ct); |
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.
Is this really needed for all adopted threads? Could we lazy initialize it when somebody tries to wait for the task instead?
While looking at #55525 I found that the implementation wasn't working correctly.
I added it to Base.Experimental so people don't need to handroll their own and am also testing a version of what the issue was hitting.
@vtjnash Is the wakeup of thread 0 for libuv only or do I need to wake both the IO thread and thread 0 always?