Initial implementation of ScheduledExecutor

PiperOrigin-RevId: 396036314
This commit is contained in:
jfcarroll
2021-09-10 17:02:15 -07:00
committed by Copybara-Service
parent 6926f5cd4b
commit 2de4bfeda9
5 changed files with 350 additions and 12 deletions
+14 -3
View File
@@ -15,6 +15,8 @@
#ifndef PLATFORM_IMPL_WINDOWS_CANCELABLE_H_
#define PLATFORM_IMPL_WINDOWS_CANCELABLE_H_
#include <windows.h>
#include "platform/api/cancelable.h"
namespace location {
@@ -25,11 +27,20 @@ namespace windows {
// long-running operations.
class Cancelable : public api::Cancelable {
public:
// TODO(b/184975123): replace with real implementation.
Cancelable(HANDLE handle) : handle_(handle) {}
~Cancelable() override = default;
// TODO(b/184975123): replace with real implementation.
bool Cancel() override { return false; };
bool Cancel() override {
if (CancelWaitableTimer(handle_)) {
CloseHandle(handle_);
return true;
}
return false;
};
private:
HANDLE handle_;
};
} // namespace windows