forked from rdkcentral/networkmanager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f7a531
commit 21b62f8
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#pragma once | ||
|
||
#include <gmock/gmock.h> | ||
|
||
#include "Module.h" | ||
|
||
class WorkerPoolImplementation : public WPEFramework::Core::WorkerPool { | ||
private: | ||
class Dispatcher : public WPEFramework::Core::ThreadPool::IDispatcher { | ||
public: | ||
Dispatcher(const Dispatcher&) = delete; | ||
Dispatcher& operator=(const Dispatcher&) = delete; | ||
|
||
Dispatcher() = default; | ||
~Dispatcher() override = default; | ||
|
||
private: | ||
void Initialize() override {} | ||
void Deinitialize() override {} | ||
void Dispatch(WPEFramework::Core::IDispatch* job) override | ||
{ | ||
job->Dispatch(); | ||
} | ||
}; | ||
|
||
public: | ||
WorkerPoolImplementation() = delete; | ||
WorkerPoolImplementation(const WorkerPoolImplementation&) = delete; | ||
WorkerPoolImplementation& operator=(const WorkerPoolImplementation&) = delete; | ||
|
||
WorkerPoolImplementation(const uint8_t threads, const uint32_t stackSize, const uint32_t queueSize) | ||
: WPEFramework::Core::WorkerPool(threads - 1, stackSize, queueSize, &_dispatcher) | ||
, _dispatcher() | ||
{ | ||
} | ||
|
||
virtual ~WorkerPoolImplementation() | ||
{ | ||
WPEFramework::Core::WorkerPool::Stop(); | ||
} | ||
|
||
private: | ||
Dispatcher _dispatcher; | ||
}; |