mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
cscore: Change impl to only one singleton (#1398)
This avoids a number of shutdown use-after-free races by controlling the destruction order. It also is a prerequisite to making the internal interfaces mockable for unit testing.
This commit is contained in:
@@ -14,16 +14,14 @@
|
||||
|
||||
namespace cs {
|
||||
|
||||
class Notifier;
|
||||
class SourceImpl;
|
||||
|
||||
class Telemetry {
|
||||
friend class TelemetryTest;
|
||||
|
||||
public:
|
||||
static Telemetry& GetInstance() {
|
||||
static Telemetry instance;
|
||||
return instance;
|
||||
}
|
||||
explicit Telemetry(Notifier& notifier) : m_notifier(notifier) {}
|
||||
~Telemetry();
|
||||
|
||||
void Start();
|
||||
@@ -41,7 +39,7 @@ class Telemetry {
|
||||
void RecordSourceFrames(const SourceImpl& source, int quantity);
|
||||
|
||||
private:
|
||||
Telemetry();
|
||||
Notifier& m_notifier;
|
||||
|
||||
class Thread;
|
||||
wpi::SafeThreadOwner<Thread> m_owner;
|
||||
|
||||
Reference in New Issue
Block a user