-
-
Notifications
You must be signed in to change notification settings - Fork 3.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 creation/destruction callbacks for TaskPool #1991
Comments
farnoy
added
C-Feature
A new feature, making something new possible
S-Needs-Triage
This issue needs to be labelled
labels
Apr 23, 2021
alice-i-cecile
added
A-Core
Common functionality for all bevy apps
and removed
S-Needs-Triage
This issue needs to be labelled
labels
Apr 23, 2021
bors bot
pushed a commit
that referenced
this issue
Dec 20, 2022
# Objective Fix #1991. Allow users to have a bit more control over the creation and finalization of the threads in `TaskPool`. ## Solution Add new methods to `TaskPoolBuilder` that expose callbacks that are called to initialize and finalize each thread in the `TaskPool`. Unlike the proposed solution in #1991, the callback is argument-less. If an an identifier is needed, `std::thread::current` should provide that information easily. Added a unit test to ensure that they're being called correctly.
bors bot
pushed a commit
that referenced
this issue
Dec 20, 2022
# Objective Fix #1991. Allow users to have a bit more control over the creation and finalization of the threads in `TaskPool`. ## Solution Add new methods to `TaskPoolBuilder` that expose callbacks that are called to initialize and finalize each thread in the `TaskPool`. Unlike the proposed solution in #1991, the callback is argument-less. If an an identifier is needed, `std::thread::current` should provide that information easily. Added a unit test to ensure that they're being called correctly.
alradish
pushed a commit
to alradish/bevy
that referenced
this issue
Jan 22, 2023
# Objective Fix bevyengine#1991. Allow users to have a bit more control over the creation and finalization of the threads in `TaskPool`. ## Solution Add new methods to `TaskPoolBuilder` that expose callbacks that are called to initialize and finalize each thread in the `TaskPool`. Unlike the proposed solution in bevyengine#1991, the callback is argument-less. If an an identifier is needed, `std::thread::current` should provide that information easily. Added a unit test to ensure that they're being called correctly.
ItsDoot
pushed a commit
to ItsDoot/bevy
that referenced
this issue
Feb 1, 2023
# Objective Fix bevyengine#1991. Allow users to have a bit more control over the creation and finalization of the threads in `TaskPool`. ## Solution Add new methods to `TaskPoolBuilder` that expose callbacks that are called to initialize and finalize each thread in the `TaskPool`. Unlike the proposed solution in bevyengine#1991, the callback is argument-less. If an an identifier is needed, `std::thread::current` should provide that information easily. Added a unit test to ensure that they're being called correctly.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What problem does this solve or what need does it fill?
I'd like to be able to run something on each created thread in a TaskPool after it's spawned and before it's destroyed. This would be useful for instrumentation purposes, profilers.
What solution would you like?
I propose adding two new boxed function fields in
TaskPoolBuilder
to define these operations.What alternative(s) have you considered?
I considered spawning dummy tasks right after creating a TaskPool, but I don't expect to get a stable, round-robin order with each spawned task.
The text was updated successfully, but these errors were encountered: