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

Feature Request: Select thread/threadpool subset for @spawn #34240

Closed
IanButterworth opened this issue Jan 2, 2020 · 3 comments
Closed

Feature Request: Select thread/threadpool subset for @spawn #34240

IanButterworth opened this issue Jan 2, 2020 · 3 comments
Labels
multithreading Base.Threads and related functionality

Comments

@IanButterworth
Copy link
Sponsor Member

IanButterworth commented Jan 2, 2020

Say you have a gui interface with multiple long-running, yielding background loops, and for example here JULIA_NUM_THREADS=3, and you wanted to maintain a responsive gui.

@spawn gui()
@spawn looper1()
@spawn looper2()
@spawn looper3()

In this example, it would be nice to be able to allow a dedicated thread for gui().

Something like this perhaps:

@spawn 1 gui()
@spawn 2 looper1()
@spawn 3 looper2()
@spawn 3 looper3()

or

@spawn 1 gui()
@spawn 2:nthreads() looper1()
@spawn 2:nthreads() looper2()
@spawn 2:nthreads() looper3()

An alternative would be to tell spawn not to use a specific thread, but I'm not sure what a good API would be for that

@JeffBezanson
Copy link
Sponsor Member

Looks like the same issue as #34267

@tro3
Copy link

tro3 commented Feb 1, 2020

@JeffBezanson is correct. Same issue. I was not planning on adding to ThreadPools (because the case is not structured-concurrent), but @vtjnash’s pin suggestion will do the trick for this. I’ll add just to cover the case, even though no real Pool is involved.

@JeffBezanson
Copy link
Sponsor Member

Closing as duplicate

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

No branches or pull requests

4 participants