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 option to use @spawn :samepool for using the same threadpool as the caller #57109

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

IanButterworth
Copy link
Member

@IanButterworth IanButterworth commented Jan 20, 2025

Adds Threads.@spawn :samepool foo() as shorthand for Threads.@spawn Threads.threadpool() foo() to make it easier to stick within the same threadpool.

ConcurrentUtilities.jl already demonstrates this is desired functionality.

One common use for this is replacing @async with @spawn when there's an interactive thread, given that the main task runs on thread 1, so a bare @spawn will change threadpool to :default, perhaps unexpectedly.

NEWS.md Outdated Show resolved Hide resolved
@IanButterworth
Copy link
Member Author

Maybe :samepool would be clearer?

@IanButterworth IanButterworth changed the title Add option to use @spawn :same for using the same threadpool as the caller Add option to use @spawn :samepool for using the same threadpool as the caller Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multithreading Base.Threads and related functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant