core: Switch to unique_ptr for usage of Common::Fiber.

- With using unique_ptr instead of shared_ptr, we have more explicit ownership of the context.
- Fixes a memory leak due to circular reference of the shared pointer.
This commit is contained in:
bunnei 2021-02-27 11:56:04 -08:00
parent 09f7c355c6
commit 51fb0a6f96
10 changed files with 58 additions and 59 deletions

View file

@ -83,7 +83,7 @@ private:
void RunThread(std::size_t core);
struct CoreData {
std::shared_ptr<Common::Fiber> host_context;
std::unique_ptr<Common::Fiber> host_context;
std::unique_ptr<Common::Event> enter_barrier;
std::unique_ptr<Common::Event> exit_barrier;
std::atomic<bool> is_running;