mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-24 06:49:24 -05:00
Simplify MessageQueue pop() usage.
This commit is contained in:
parent
d8b3b4cb6b
commit
b13081696d
@ -123,15 +123,9 @@ private:
|
||||
}
|
||||
|
||||
void handle_application_queue() {
|
||||
while(true) {
|
||||
std::array<uint8_t, Message::MAX_SIZE> message_buffer;
|
||||
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());
|
||||
if( message_size ) {
|
||||
context.message_map.send(message);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
std::array<uint8_t, Message::MAX_SIZE> message_buffer;
|
||||
while(const Message* const message = shared_memory.application_queue.pop(message_buffer)) {
|
||||
context.message_map.send(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,15 +242,9 @@ private:
|
||||
}
|
||||
|
||||
void handle_baseband_queue() {
|
||||
while(true) {
|
||||
std::array<uint8_t, Message::MAX_SIZE> message_buffer;
|
||||
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());
|
||||
if( message_size ) {
|
||||
message_map.send(message);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
std::array<uint8_t, Message::MAX_SIZE> message_buffer;
|
||||
while(const Message* const message = shared_memory.baseband_queue.pop(message_buffer)) {
|
||||
message_map.send(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,8 +47,9 @@ public:
|
||||
return push(&message, sizeof(message));
|
||||
}
|
||||
|
||||
size_t pop(void* const buf, const size_t len) {
|
||||
return fifo.out_r(buf, len);
|
||||
const Message* pop(std::array<uint8_t, Message::MAX_SIZE>& buf) {
|
||||
const Message* const p = reinterpret_cast<Message*>(buf.data());
|
||||
return fifo.out_r(buf.data(), buf.size()) ? p : nullptr;
|
||||
}
|
||||
|
||||
size_t len() const {
|
||||
|
Loading…
Reference in New Issue
Block a user