mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Fixed some test issues
PiperOrigin-RevId: 662722512
This commit is contained in:
committed by
Copybara-Service
parent
cad1ef6bf3
commit
25eec0ff0f
@@ -29,13 +29,16 @@
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
Timer::Timer()
|
||||
: use_task_scheduler_(NearbyFlags::GetInstance().GetBoolFlag(
|
||||
platform::config_package_nearby::nearby_platform_feature::
|
||||
kEnableTaskScheduler)) {}
|
||||
|
||||
Timer::~Timer() { Stop(); }
|
||||
|
||||
bool Timer::Create(int delay, int interval,
|
||||
absl::AnyInvocable<void()> callback) {
|
||||
if (NearbyFlags::GetInstance().GetBoolFlag(
|
||||
platform::config_package_nearby::nearby_platform_feature::
|
||||
kEnableTaskScheduler)) {
|
||||
if (use_task_scheduler_) {
|
||||
absl::MutexLock lock(&mutex_);
|
||||
if ((delay < 0) || (interval < 0)) {
|
||||
NEARBY_LOGS(WARNING)
|
||||
@@ -95,9 +98,7 @@ bool Timer::Create(int delay, int interval,
|
||||
}
|
||||
|
||||
bool Timer::Stop() {
|
||||
if (NearbyFlags::GetInstance().GetBoolFlag(
|
||||
platform::config_package_nearby::nearby_platform_feature::
|
||||
kEnableTaskScheduler)) {
|
||||
if (use_task_scheduler_) {
|
||||
absl::MutexLock lock(&mutex_);
|
||||
if (cancelable_task_ == nullptr) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user