core: Make the exclusive monitor a unique_ptr instead of a shared_ptr

Like the barrier, this is owned entirely by the System and will always
outlive the encompassing state, so shared ownership semantics aren't
necessary here.
This commit is contained in:
Lioncash 2018-10-15 08:53:01 -04:00
parent c34efbbd60
commit aeadbfa790
5 changed files with 13 additions and 15 deletions

View file

@ -41,8 +41,7 @@ private:
class Cpu {
public:
Cpu(std::shared_ptr<ExclusiveMonitor> exclusive_monitor, CpuBarrier& cpu_barrier,
std::size_t core_index);
Cpu(ExclusiveMonitor& exclusive_monitor, CpuBarrier& cpu_barrier, std::size_t core_index);
~Cpu();
void RunLoop(bool tight_loop = true);
@ -71,7 +70,7 @@ public:
return core_index;
}
static std::shared_ptr<ExclusiveMonitor> MakeExclusiveMonitor(std::size_t num_cores);
static std::unique_ptr<ExclusiveMonitor> MakeExclusiveMonitor(std::size_t num_cores);
private:
void Reschedule();