Skip to content

Commit

Permalink
feat: add ITaskManager abstract base class
Browse files Browse the repository at this point in the history
This class should be the starting point for a class whose
responsibility is going to be dealing with creating all the
Agent related tasks. We aim at supporting both multithreading
and coroutines as our concurrency model, but we allow to swap
coroutines implementations by templating the awaitable type.

Given the current status of the repository this will be momentarily
in the agent folder, but it would be wise to move it to a separate
cmake directory to hide the boost dependency for the implementation
here provided.
  • Loading branch information
jr0me committed Jul 17, 2024
1 parent da15031 commit f5cc4ae
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/agent/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ set(SOURCES

set(HEADERS
include/agent.hpp
include/itask_manager.hpp
)

add_library(agent ${SOURCES} ${HEADERS})
Expand Down
16 changes: 16 additions & 0 deletions src/agent/include/itask_manager.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

#include <functional>

template<typename CoroutineTaskType>
class ITaskManager
{
public:
virtual ~ITaskManager() = default;

virtual void start(size_t numThreads) = 0;
virtual void stop() = 0;

virtual void enqueueTask(std::function<void()> task) = 0;
virtual void enqueueTask(CoroutineTaskType task) = 0;
};

0 comments on commit f5cc4ae

Please sign in to comment.