mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-23 17:01:31 -04:00
Change IPC to exchange data, not pointers.
This commit is contained in:
parent
f99016d78f
commit
4126f1ab1f
7 changed files with 76 additions and 126 deletions
|
@ -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();
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue