|
C++ Concurrency Sandbox
|
A pool of worker threads that retrieves tasks based on priority. More...
Public Member Functions | |
| PriorityThreadPool (size_t num_threads) | |
| Initializes the pool and starts worker threads. | |
| void | enqueue (int priority, std::function< void()> f) |
| Submits a task with a specific priority level. | |
| ~PriorityThreadPool () | |
| Gracefully joins all worker threads after processing remaining tasks. | |
A pool of worker threads that retrieves tasks based on priority.
Definition at line 45 of file Priority.cpp.
|
inline |
Initializes the pool and starts worker threads.
| num_threads | The number of worker threads to maintain. |
Definition at line 86 of file Priority.cpp.
|
inline |
Gracefully joins all worker threads after processing remaining tasks.
Definition at line 108 of file Priority.cpp.
|
inline |
Submits a task with a specific priority level.
| priority | Importance level (e.g., 10 for urgent, 1 for background). |
| f | The function or lambda to execute. |
Definition at line 97 of file Priority.cpp.
Referenced by main().