Skip to content

Commit

Permalink
Create WorkerPoolImplementation.h
Browse files Browse the repository at this point in the history
  • Loading branch information
parvathika authored Sep 2, 2024
1 parent 5f7a531 commit 21b62f8
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions mocks/thunder /WorkerPoolImplementation.h
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;
};

0 comments on commit 21b62f8

Please sign in to comment.