bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Support `on_thread_spawn` and `on_thread_destroy` for `TaskPoolPlugin`

Open Logiquo opened this issue 1 year ago • 2 comments

Objective

  • Allow to configure on_thread_spawn and on_thread_destroy when using TaskPoolPlugin of bevy.

Solution

  • In TaskPoolThreadAssignmentPolicy, two options on_thread_spawn and on_thread_destroy are added, which will be passed to two new methods motioned above when creating corresponding task pool using builder.
  • Due to lack of debug derive for these two options, manually implement the debug for TaskPoolThreadAssignmentPolicy.

Changelog

Added

  • on_thread_spawn option and on_thread_destroy option to the TaskPoolPlugin, allow user to customize them as needed.

Migration Guide

  • TaskPooolThreadAssignmentPolicy now has two additional fields: on_thread_spawn and on_thread_destroy. Please consider defaulting them to None.

Logiquo avatar Apr 20 '24 21:04 Logiquo

Welcome, new contributor!

Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨

github-actions[bot] avatar Apr 20 '24 21:04 github-actions[bot]

Ah of course, don't know how I missed those.

NthTensor avatar Apr 21 '24 13:04 NthTensor