Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions include/ccapi_cpp/ccapi_event_dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class EventDispatcher {
CCAPI_LOGGER_FUNCTION_EXIT;
}

void dispatch(const std::function<void()>& op) {
virtual void dispatch(const std::function<void()>& op) {
CCAPI_LOGGER_FUNCTION_ENTER;
if (this->shouldContinue.load()) {
CCAPI_LOGGER_TRACE("start to dispatch an operation");
Expand All @@ -51,18 +51,18 @@ class EventDispatcher {
CCAPI_LOGGER_FUNCTION_EXIT;
}

void start() {
virtual void start() {
this->shouldContinue = true;
for (size_t i = 0; i < numDispatcherThreads; i++) {
this->dispatcherThreads.push_back(std::thread(&EventDispatcher::dispatch_thread_handler, this));
this->dispatcherThreads.push_back(std::thread(&EventDispatcher::dispatchThreadHandler, this));
}
}

void resume() { this->shouldContinue = true; }
virtual void resume() { this->shouldContinue = true; }

void pause() { this->shouldContinue = false; }
virtual void pause() { this->shouldContinue = false; }

void stop() {
virtual void stop() {
std::unique_lock<std::mutex> lock(this->lock);
this->quit = true;
lock.unlock();
Expand All @@ -73,9 +73,9 @@ class EventDispatcher {
}
#ifndef CCAPI_EXPOSE_INTERNAL

private:
protected:
#endif
void dispatch_thread_handler() {
virtual void dispatchThreadHandler() {
CCAPI_LOGGER_FUNCTION_ENTER;
std::unique_lock<std::mutex> lock(this->lock);
do {
Expand Down
Loading