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,28 @@
|
||||
#ifndef PLATFORM_V2_PUBLIC_MULTI_THREAD_EXECUTOR_H_
|
||||
#define PLATFORM_V2_PUBLIC_MULTI_THREAD_EXECUTOR_H_
|
||||
|
||||
#include "platform_v2/api/platform.h"
|
||||
#include "platform_v2/public/submittable_executor.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
// An Executor that reuses a fixed number of threads operating off a shared
|
||||
// unbounded queue.
|
||||
//
|
||||
// https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executors.html#newFixedThreadPool-int-
|
||||
class MultiThreadExecutor final : public SubmittableExecutor {
|
||||
public:
|
||||
using Platform = api::ImplementationPlatform;
|
||||
explicit MultiThreadExecutor(int max_parallelism)
|
||||
: SubmittableExecutor(
|
||||
Platform::CreateMultiThreadExecutor(max_parallelism)) {}
|
||||
MultiThreadExecutor(MultiThreadExecutor&&) = default;
|
||||
MultiThreadExecutor& operator=(MultiThreadExecutor&&) = default;
|
||||
~MultiThreadExecutor() override = default;
|
||||
};
|
||||
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_V2_PUBLIC_MULTI_THREAD_EXECUTOR_H_
|
||||
Reference in New Issue
Block a user