mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-14 10:07:43 +00:00
Change IPC to exchange data, not pointers.
This commit is contained in:
@@ -29,9 +29,15 @@
|
||||
|
||||
class MessageQueue {
|
||||
public:
|
||||
bool push(Message* const message);
|
||||
template<typename T>
|
||||
bool push(const T& message) {
|
||||
static_assert(sizeof(T) <= Message::MAX_SIZE, "Message::MAX_SIZE too small for message type");
|
||||
static_assert(std::is_base_of<Message, T>::value, "type is not based on Message");
|
||||
|
||||
Message* pop();
|
||||
return push(&message, sizeof(message));
|
||||
}
|
||||
|
||||
size_t pop(void* const buf, const size_t len);
|
||||
|
||||
size_t len() const {
|
||||
return fifo.len();
|
||||
@@ -42,9 +48,10 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
FIFO<Message*, 8> fifo;
|
||||
FIFO<uint8_t, 11> fifo;
|
||||
|
||||
bool push(const void* const buf, const size_t len);
|
||||
|
||||
bool enqueue(Message* const message);
|
||||
void signal();
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user