mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
lightningd/msg_queue: helper for queues of messages/
Since they're short, we use a simple array. This can be replaced later. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
21
lightningd/msg_queue.h
Normal file
21
lightningd/msg_queue.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/* Helper for simple message queues. */
|
||||
#ifndef LIGHTNING_LIGHTNINGD_MSG_QUEUE_H
|
||||
#define LIGHTNING_LIGHTNINGD_MSG_QUEUE_H
|
||||
#include "config.h"
|
||||
#include <ccan/io/io.h>
|
||||
#include <ccan/short_types/short_types.h>
|
||||
|
||||
struct msg_queue {
|
||||
const u8 **q;
|
||||
};
|
||||
|
||||
void msg_queue_init(struct msg_queue *q, const tal_t *ctx);
|
||||
|
||||
void msg_enqueue(struct msg_queue *q, const u8 *add);
|
||||
|
||||
const u8 *msg_dequeue(struct msg_queue *q);
|
||||
|
||||
#define msg_queue_wait(conn, q, next, arg) \
|
||||
io_out_wait((conn), (q), (next), (arg))
|
||||
|
||||
#endif /* LIGHTNING_LIGHTNINGD_MSG_QUEUE_H */
|
||||
Reference in New Issue
Block a user