68 std::lock_guard<std::mutex> lock(thread_state.play_mutex);
77 std::lock_guard<std::mutex> lock(thread_state.queue_mutex);
84 void cleanupAllThreads()
94 catch (
const std::exception& e)
97 std::cerr <<
"Exception during thread cleanup: " << e.what() << std::endl;
101 std::cerr <<
"Unknown exception during thread cleanup." << std::endl;
113 std::shared_ptr<WorkerThreadPool> worker_pool;
void lockQueueMutex(ThreadState &thread_state)
Locks the queue mutex for the provided thread state.
Definition thread_manager.hpp:75
auto getThreadState() -> ThreadState &
Destructor to clean up resources and threads.
Definition thread_manager.hpp:54
ThreadManager()
Construct a ThreadManager with a worker thread pool.
Definition thread_manager.hpp:43
void lockPlayMutex(ThreadState &thread_state)
Locks the play mutex for the provided thread state.
Definition thread_manager.hpp:66
auto getWorkerThreadPool() -> WorkerThreadPool &
Get the worker thread pool.
Definition thread_manager.hpp:60
A thread pool that manages a collection of worker threads.
Definition workers.hpp:23
Represents the state of a thread managed by ThreadManager.
Definition thread_manager.hpp:27
std::thread playNextSongThread
Thread for handling "play next song" operations.
Definition thread_manager.hpp:37
std::future< void > play_future
Future object for async play operations.
Definition thread_manager.hpp:35
std::mutex play_mutex
Mutex for synchronizing play state.
Definition thread_manager.hpp:28
std::mutex audioDevicesMutex
Mutex for synchronizing audio device access.
Definition thread_manager.hpp:30
std::mutex queue_mutex
Mutex for synchronizing queue operations.
Definition thread_manager.hpp:29
std::unique_ptr< std::thread > mpris_dbus_thread
Unique pointer for DBus thread.
Definition thread_manager.hpp:36
std::atomic< bool > is_processing
Indicates whether the thread is processing.
Definition thread_manager.hpp:32
std::atomic< bool > is_playing
Indicates whether the thread is playing.
Definition thread_manager.hpp:33