projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6c5db0f
)
Cleanup: coding style.
author
Carl Hetherington
<cth@carlh.net>
Tue, 26 Sep 2023 18:53:43 +0000
(20:53 +0200)
committer
Carl Hetherington
<cth@carlh.net>
Wed, 29 Nov 2023 20:19:56 +0000
(21:19 +0100)
src/lib/grok/messenger.h
patch
|
blob
|
history
diff --git
a/src/lib/grok/messenger.h
b/src/lib/grok/messenger.h
index 5cb21a1cd800fff1ad33b871ba8b6ddad1552852..50d44e251718edcedb5aecee2c65098665d7fe3c 100644
(file)
--- a/
src/lib/grok/messenger.h
+++ b/
src/lib/grok/messenger.h
@@
-461,7
+461,7
@@
static void processorThread(Messenger* messenger, std::function<void(std::string
struct Messenger
{
explicit Messenger(MessengerInit init)
struct Messenger
{
explicit Messenger(MessengerInit init)
- : running(true),
initialized_(false), shutdown_
(false), init_(init),
+ : running(true),
_initialized(false), _shutdown
(false), init_(init),
outboundSynch_(nullptr),
inboundSynch_(nullptr), uncompressed_buffer_(nullptr), compressed_buffer_(nullptr),
uncompressed_fd_(0), compressed_fd_(0)
outboundSynch_(nullptr),
inboundSynch_(nullptr), uncompressed_buffer_(nullptr), compressed_buffer_(nullptr),
uncompressed_fd_(0), compressed_fd_(0)
@@
-591,23
+591,29
@@
struct Messenger
}
std::unique_lock<std::mutex> lk(shutdownMutex_);
}
std::unique_lock<std::mutex> lk(shutdownMutex_);
-
initialized_
= true;
+
_initialized
= true;
clientInitializedCondition_.notify_all();
}
clientInitializedCondition_.notify_all();
}
- bool waitForClientInit(void)
+
+ bool waitForClientInit()
{
{
- if
(initialized_)
+ if
(_initialized) {
return true;
return true;
+ }
std::unique_lock<std::mutex> lk(shutdownMutex_);
std::unique_lock<std::mutex> lk(shutdownMutex_);
- if(initialized_)
+
+ if (_initialized) {
return true;
return true;
- else if (shutdown_)
+ } else if (_shutdown) {
return false;
return false;
- clientInitializedCondition_.wait(lk, [this]{return initialized_ || shutdown_;});
+ }
+
+ clientInitializedCondition_.wait(lk, [this] { return _initialized || _shutdown; });
- return
initialized_ && !shutdown_
;
+ return
_initialized && !_shutdown
;
}
}
+
static size_t uncompressedFrameSize(uint32_t w, uint32_t h, uint32_t samplesPerPixel)
{
return sizeof(uint16_t) * w * h * samplesPerPixel;
static size_t uncompressedFrameSize(uint32_t w, uint32_t h, uint32_t samplesPerPixel)
{
return sizeof(uint16_t) * w * h * samplesPerPixel;
@@
-637,8
+643,8
@@
struct Messenger
return (uint8_t*)(compressed_buffer_ + frameId * init_.compressedFrameSize_);
}
std::atomic_bool running;
return (uint8_t*)(compressed_buffer_ + frameId * init_.compressedFrameSize_);
}
std::atomic_bool running;
- bool
initialized_
;
- bool
shutdown_
;
+ bool
_initialized
;
+ bool
_shutdown
;
MessengerBlockingQueue<std::string> sendQueue;
MessengerBlockingQueue<std::string> receiveQueue;
MessengerBlockingQueue<BufferSrc> availableBuffers_;
MessengerBlockingQueue<std::string> sendQueue;
MessengerBlockingQueue<std::string> receiveQueue;
MessengerBlockingQueue<BufferSrc> availableBuffers_;
@@
-754,11
+760,11
@@
struct Msg
};
static void processorThread(Messenger* messenger, std::function<void(std::string)> processor)
{
};
static void processorThread(Messenger* messenger, std::function<void(std::string)> processor)
{
- while(messenger->running)
- {
+ while (messenger->running) {
std::string message;
std::string message;
- if
(!messenger->receiveQueue.waitAndPop(message))
+ if
(!messenger->receiveQueue.waitAndPop(message)) {
break;
break;
+ }
if(!messenger->running)
break;
Msg msg(message);
if(!messenger->running)
break;
Msg msg(message);
@@
-856,7
+862,7
@@
struct ScheduledMessenger : public Messenger
}
++framesCompressed_;
send(GRK_MSGR_BATCH_PROCESSSED_COMPRESSED, compressedFrameId);
}
++framesCompressed_;
send(GRK_MSGR_BATCH_PROCESSSED_COMPRESSED, compressedFrameId);
- if (
shutdown_
&& framesCompressed_ == framesScheduled_)
+ if (
_shutdown
&& framesCompressed_ == framesScheduled_)
shutdownCondition_.notify_all();
}
void shutdown(void){
shutdownCondition_.notify_all();
}
void shutdown(void){
@@
-864,7
+870,7
@@
struct ScheduledMessenger : public Messenger
std::unique_lock<std::mutex> lk(shutdownMutex_);
if (!async_result_.valid())
return;
std::unique_lock<std::mutex> lk(shutdownMutex_);
if (!async_result_.valid())
return;
-
shutdown_
= true;
+
_shutdown
= true;
if (framesScheduled_) {
uint32_t scheduled = framesScheduled_;
send(GRK_MSGR_BATCH_FLUSH, scheduled);
if (framesScheduled_) {
uint32_t scheduled = framesScheduled_;
send(GRK_MSGR_BATCH_FLUSH, scheduled);