Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu_X86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

- name: Test
working-directory: build
run: ctest --output-on-failure
run: ctest -LE benchmark --output-on-failure

- name: Run PriorityQueue Benchmarks
run: ./build/benchmarkbin/ThreadPool_PriorityQueue_Benchmark
Expand Down
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
"ios": "cpp",
"locale": "cpp",
"source_location": "cpp",
"queue": "cpp"
"queue": "cpp",
"print": "cpp",
"stack": "cpp"
}
}
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ set(THREADPOOL_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
# Define the source files
set(THREADPOOL_SOURCES
${THREADPOOL_SOURCE_DIR}/ThreadPool.cpp
${THREADPOOL_SOURCE_DIR}/ThreadMode.cpp
${THREADPOOL_SOURCE_DIR}/PriorityQueue.cpp
${THREADPOOL_SOURCE_DIR}/ThreadTask.cpp
)
Expand Down
35 changes: 35 additions & 0 deletions include/ThreadMode.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#pragma once

//--------------------------------------------------------------
// Standard library
//--------------------------------------------------------------
#include <iostream>
//--------------------------------------------------------------
/** @namespace ThreadPool
* @brief A namespace containing the ThreadPool class.
*/
namespace ThreadPool {
//--------------------------------------------------------------
/**
* @enum ThreadMode
* @brief Enum class to specify threading mode for ThreadPool.
*
* This enum class is used to define the threading mode for the ThreadPool class. It supports two modes:
* STANDARD and PRIORITY. STANDARD mode is used for regular operation, while PRIORITY mode allows for
* priority-based task execution within the ThreadPool.
*
* @param ThreadMode::STANDARD
* STANDARD mode indicates that the ThreadPool will process tasks in a first-come, first-served manner,
* without considering task priority. This is the default mode.
*
* @param ThreadMode::PRIORITY
* PRIORITY mode indicates that the ThreadPool will process tasks based on their priority, allowing
* higher priority tasks to be executed before lower priority ones.
*/
enum class ThreadMode : bool {
STANDARD = false,
PRIORITY = true
}; // end enum class ThreadMode
//--------------------------------------------------------------
} // end namespace ThreadPool
//--------------------------------------------------------------
22 changes: 1 addition & 21 deletions include/ThreadPool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,14 @@
//--------------------------------------------------------------
// User Defined library
//--------------------------------------------------------------
#include "ThreadMode.hpp"
#include "PriorityQueue.hpp"
#include "ThreadTask.hpp"
//--------------------------------------------------------------
/** @namespace ThreadPool
* @brief A namespace containing the ThreadPool class.
*/
namespace ThreadPool {
//--------------------------------------------------------------
/**
* @enum ThreadMode
* @brief Enum class to specify threading mode for ThreadPool.
*
* This enum class is used to define the threading mode for the ThreadPool class. It supports two modes:
* STANDARD and PRIORITY. STANDARD mode is used for regular operation, while PRIORITY mode allows for
* priority-based task execution within the ThreadPool.
*
* @param ThreadMode::STANDARD
* STANDARD mode indicates that the ThreadPool will process tasks in a first-come, first-served manner,
* without considering task priority. This is the default mode.
*
* @param ThreadMode::PRIORITY
* PRIORITY mode indicates that the ThreadPool will process tasks based on their priority, allowing
* higher priority tasks to be executed before lower priority ones.
*/
enum class ThreadMode : bool {
STANDARD = false,
PRIORITY = true
}; // end enum class ThreadMode
//--------------------------------------------------------------
/**
* @class ThreadPool
Expand Down
2 changes: 2 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ endif
threadpool_includes = include_directories('include')
threadpool_sources = files(
'src/ThreadPool.cpp',
'src/ThreadMode.cpp',
'src/PriorityQueue.cpp',
'src/ThreadTask.cpp'
)
Expand Down Expand Up @@ -122,6 +123,7 @@ endif
install_headers(
files(
'include/ThreadPool.hpp',
'src/ThreadMode.hpp',
'include/PriorityQueue.hpp',
'include/ThreadTask.hpp'
),
Expand Down
5 changes: 5 additions & 0 deletions src/ThreadMode.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//--------------------------------------------------------------
// Main Header
//--------------------------------------------------------------
#include "ThreadMode.hpp"
//--------------------------------------------------------------
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ create_test_target(ThreadTaskTest ThreadTaskTest.cpp)
create_test_target(ThreadPoolTest ThreadPoolTest.cpp)
create_test_target(ThreadPoolDisableTest ThreadPoolDisableTest.cpp)
create_test_target(ThreadPoolDequeTest ThreadPoolDequeTest.cpp)
create_test_target(ThreadPoolDisableDequeTest ThreadPoolDisableDequeTest.cpp)
create_test_target(ThreadPoolDisableDequeTest ThreadPoolDisableDequeTest.cpp)
Loading