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:
parent
09f7c355c6
commit
51fb0a6f96
10 changed files with 58 additions and 59 deletions
|
@ -68,12 +68,12 @@ public:
|
|||
|
||||
void OnThreadStart();
|
||||
|
||||
[[nodiscard]] std::shared_ptr<Common::Fiber>& ControlContext() {
|
||||
return switch_fiber;
|
||||
[[nodiscard]] Common::Fiber* ControlContext() {
|
||||
return switch_fiber.get();
|
||||
}
|
||||
|
||||
[[nodiscard]] const std::shared_ptr<Common::Fiber>& ControlContext() const {
|
||||
return switch_fiber;
|
||||
[[nodiscard]] const Common::Fiber* ControlContext() const {
|
||||
return switch_fiber.get();
|
||||
}
|
||||
|
||||
[[nodiscard]] u64 UpdateHighestPriorityThread(KThread* highest_thread);
|
||||
|
@ -178,7 +178,7 @@ private:
|
|||
|
||||
KThread* idle_thread;
|
||||
|
||||
std::shared_ptr<Common::Fiber> switch_fiber{};
|
||||
std::unique_ptr<Common::Fiber> switch_fiber{};
|
||||
|
||||
struct SchedulingState {
|
||||
std::atomic<bool> needs_scheduling;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue