bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Add thread create/destroy callbacks to TaskPool

Open james7132 opened this issue 3 years ago • 1 comments
trafficstars

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.

james7132 avatar Nov 12 '22 16:11 james7132

made a some minor comments on the test. Would be willing to approve without any changes

hymm avatar Nov 12 '22 21:11 hymm

bors r+

mockersf avatar Dec 20 '22 01:12 mockersf

Build failed (retrying...):

bors[bot] avatar Dec 20 '22 01:12 bors[bot]

Build failed:

bors[bot] avatar Dec 20 '22 01:12 bors[bot]

bors retry

james7132 avatar Dec 20 '22 16:12 james7132