aboutsummaryrefslogtreecommitdiffstats
path: root/common/rfb/DecodeManager.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/rfb/DecodeManager.h')
-rw-r--r--common/rfb/DecodeManager.h37
1 files changed, 21 insertions, 16 deletions
diff --git a/common/rfb/DecodeManager.h b/common/rfb/DecodeManager.h
index b11b7044..146bf8ae 100644
--- a/common/rfb/DecodeManager.h
+++ b/common/rfb/DecodeManager.h
@@ -19,16 +19,18 @@
#ifndef __RFB_DECODEMANAGER_H__
#define __RFB_DECODEMANAGER_H__
+#include <condition_variable>
+#include <exception>
#include <list>
+#include <mutex>
+#include <thread>
-#include <os/Thread.h>
+#include <core/Region.h>
-#include <rfb/Region.h>
#include <rfb/encodings.h>
-namespace os {
- class Condition;
- class Mutex;
+namespace core {
+ struct Rect;
}
namespace rdr {
@@ -36,17 +38,17 @@ namespace rdr {
}
namespace rfb {
+
class CConnection;
class Decoder;
class ModifiablePixelBuffer;
- struct Rect;
class DecodeManager {
public:
DecodeManager(CConnection *conn);
~DecodeManager();
- bool decodeRect(const Rect& r, int encoding,
+ bool decodeRect(const core::Rect& r, int encoding,
ModifiablePixelBuffer* pb);
void flush();
@@ -54,7 +56,7 @@ namespace rfb {
private:
void logStats();
- void setThreadException(const std::exception& e);
+ void setThreadException();
void throwThreadException();
private:
@@ -72,43 +74,46 @@ namespace rfb {
struct QueueEntry {
bool active;
- Rect rect;
+ core::Rect rect;
int encoding;
Decoder* decoder;
const ServerParams* server;
ModifiablePixelBuffer* pb;
rdr::MemOutStream* bufferStream;
- Region affectedRegion;
+ core::Region affectedRegion;
};
std::list<rdr::MemOutStream*> freeBuffers;
std::list<QueueEntry*> workQueue;
- os::Mutex* queueMutex;
- os::Condition* producerCond;
- os::Condition* consumerCond;
+ std::mutex queueMutex;
+ std::condition_variable producerCond;
+ std::condition_variable consumerCond;
private:
- class DecodeThread : public os::Thread {
+ class DecodeThread {
public:
DecodeThread(DecodeManager* manager);
~DecodeThread();
+ void start();
void stop();
protected:
- void worker() override;
+ void worker();
DecodeManager::QueueEntry* findEntry();
private:
DecodeManager* manager;
+ std::thread* thread;
bool stopRequested;
};
std::list<DecodeThread*> threads;
- std::exception *threadException;
+ std::exception_ptr threadException;
};
+
}
#endif