mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
nearby: snapshot of cl/313536507
Signed-off-by: Alexey Polyudov <apolyudov@google.com> Change-Id: I8936b527079074d5c3af5531b9245063767cc4a7
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#ifndef PLATFORM_V2_API_SUBMITTABLE_EXECUTOR_H_
|
||||
#define PLATFORM_V2_API_SUBMITTABLE_EXECUTOR_H_
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#include "platform_v2/api/executor.h"
|
||||
#include "platform_v2/api/future.h"
|
||||
#include "platform_v2/base/runnable.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace api {
|
||||
|
||||
// Main interface to be used by platform as a base class for
|
||||
// - MultiThreadExecutorWrapper
|
||||
// - SingleThreadExecutorWrapper
|
||||
// Platform must override bool submit(std::function<void()>) method.
|
||||
class SubmittableExecutor : public Executor {
|
||||
public:
|
||||
~SubmittableExecutor() override = default;
|
||||
|
||||
// Submit a callable (with no delay).
|
||||
// Returns true, if callable was submitted, false otherwise.
|
||||
// Callable is not submitted if shutdown is in progress.
|
||||
virtual bool DoSubmit(Runnable&& wrapped_callable) = 0;
|
||||
};
|
||||
|
||||
} // namespace api
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_V2_API_SUBMITTABLE_EXECUTOR_H_
|
||||
Reference in New Issue
Block a user