mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-29 17:06:18 +02:00
abortable sleep
This commit is contained in:
parent
7353383313
commit
d41d314e27
5 changed files with 35 additions and 21 deletions
|
@ -22,6 +22,8 @@
|
|||
#include <thread>
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <map>
|
||||
#include "streamUri.h"
|
||||
#include "encoder/encoder.h"
|
||||
|
@ -83,12 +85,16 @@ public:
|
|||
|
||||
|
||||
protected:
|
||||
std::condition_variable cv_;
|
||||
std::mutex mtx_;
|
||||
std::thread thread_;
|
||||
std::atomic<bool> active_;
|
||||
|
||||
virtual void worker() = 0;
|
||||
virtual bool sleep(int32_t ms);
|
||||
void setState(const ReaderState& newState);
|
||||
|
||||
timeval tvEncodedChunk_;
|
||||
std::atomic<bool> active_;
|
||||
std::thread readerThread_;
|
||||
PcmListener* pcmListener_;
|
||||
StreamUri uri_;
|
||||
SampleFormat sampleFormat_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue