mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Fixed a data race bug in test codes
PiperOrigin-RevId: 528074883
This commit is contained in:
committed by
Copybara-Service
parent
10174f8a47
commit
46e4b3eca7
@@ -21,6 +21,11 @@
|
||||
|
||||
namespace nearby {
|
||||
|
||||
FakeClock::~FakeClock() {
|
||||
absl::MutexLock lock(&mutex_);
|
||||
observers_.clear();
|
||||
}
|
||||
|
||||
absl::Time FakeClock::Now() const {
|
||||
absl::MutexLock lock(&mutex_);
|
||||
return now_;
|
||||
|
||||
@@ -33,6 +33,7 @@ class FakeClock : public Clock {
|
||||
FakeClock() { now_ = absl::Now(); }
|
||||
FakeClock(FakeClock&&) = default;
|
||||
FakeClock& operator=(FakeClock&&) = default;
|
||||
~FakeClock() override ABSL_LOCKS_EXCLUDED(mutex_);
|
||||
|
||||
absl::Time Now() const override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user