Skip to content

Commit

Permalink
refactor(core): move ThreadPool to new thread module
Browse files Browse the repository at this point in the history
  • Loading branch information
RiscadoA committed Apr 8, 2024
1 parent 39b0dff commit 5b8d61b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ message("# Building core tests: " ${BUILD_CORE_TESTS})
# Set core source files
set(CUBOS_CORE_SOURCE
"src/log.cpp"
"src/thread_pool.cpp"
"src/thread/pool.cpp"

"src/memory/stream.cpp"
"src/memory/standard_stream.cpp"
Expand Down
13 changes: 13 additions & 0 deletions core/include/cubos/core/thread/module.dox
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/// @dir
/// @brief @ref core-thread module.

/// @namespace cubos::core::thread
/// @brief @ref core-thread module.
/// @ingroup core-thread

namespace cubos::core::thread
{
/// @defgroup core-thread Threading
/// @ingroup core
/// @brief Provides threading and asynchronous related utilities.
} // namespace cubos::core::thread
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// @file
/// @brief Class @ref cubos::core::ThreadPool.
/// @ingroup core
/// @brief Class @ref cubos::core::thread::ThreadPool.
/// @ingroup core-thread

#pragma once

Expand All @@ -11,11 +11,11 @@
#include <thread>
#include <vector>

namespace cubos::core
namespace cubos::core::thread
{
/// @brief Manages a pool of threads, to which tasks can be submitted.
/// @note Blocks on tasks to finish on destruction.
/// @ingroup core
/// @ingroup core-thread
class ThreadPool final
{
public:
Expand Down Expand Up @@ -49,4 +49,4 @@ namespace cubos::core
std::atomic<std::size_t> mNumTasks; ///< Number of tasks currently being executed.
bool mStop; ///< Set to true when the thread pool is being destroyed.
};
} // namespace cubos::core
} // namespace cubos::core::thread
4 changes: 2 additions & 2 deletions core/src/thread_pool.cpp → core/src/thread/pool.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <cubos/core/thread_pool.hpp>
#include <cubos/core/thread/pool.hpp>

using namespace cubos::core;
using cubos::core::thread::ThreadPool;

ThreadPool::ThreadPool(std::size_t numThreads)
{
Expand Down

0 comments on commit 5b8d61b

Please sign in to comment.