mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-25 07:19:28 -05:00
Check queue empty only once when reading messages.
There was a second is_empty() call hidden in the pop() call, so the while(condition) was redundant.
This commit is contained in:
parent
5d9079f87f
commit
d8b3b4cb6b
@ -123,12 +123,14 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void handle_application_queue() {
|
void handle_application_queue() {
|
||||||
while( !shared_memory.application_queue.is_empty() ) {
|
while(true) {
|
||||||
std::array<uint8_t, Message::MAX_SIZE> message_buffer;
|
std::array<uint8_t, Message::MAX_SIZE> message_buffer;
|
||||||
const Message* const message = reinterpret_cast<Message*>(message_buffer.data());
|
const Message* const message = reinterpret_cast<Message*>(message_buffer.data());
|
||||||
const auto message_size = shared_memory.application_queue.pop(message_buffer.data(), message_buffer.size());
|
const auto message_size = shared_memory.application_queue.pop(message_buffer.data(), message_buffer.size());
|
||||||
if( message_size ) {
|
if( message_size ) {
|
||||||
context.message_map.send(message);
|
context.message_map.send(message);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,12 +242,14 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void handle_baseband_queue() {
|
void handle_baseband_queue() {
|
||||||
while( !shared_memory.baseband_queue.is_empty() ) {
|
while(true) {
|
||||||
std::array<uint8_t, Message::MAX_SIZE> message_buffer;
|
std::array<uint8_t, Message::MAX_SIZE> message_buffer;
|
||||||
const Message* const message = reinterpret_cast<Message*>(message_buffer.data());
|
const Message* const message = reinterpret_cast<Message*>(message_buffer.data());
|
||||||
const auto message_size = shared_memory.baseband_queue.pop(message_buffer.data(), message_buffer.size());
|
const auto message_size = shared_memory.baseband_queue.pop(message_buffer.data(), message_buffer.size());
|
||||||
if( message_size ) {
|
if( message_size ) {
|
||||||
message_map.send(message);
|
message_map.send(message);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user