-static inline bool meshlink_queue_push(meshlink_queue_t *queue, void *data) {
- meshlink_queue_item_t *item = malloc(sizeof *item);
- if(!item)
+static inline void meshlink_queue_init(meshlink_queue_t *queue) {
+ queue->head = NULL;
+ queue->tail = NULL;
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_DEFAULT);
+ pthread_mutex_init(&queue->mutex, &attr);
+}
+
+static inline void meshlink_queue_exit(meshlink_queue_t *queue) {
+ pthread_mutex_destroy(&queue->mutex);
+}
+
+static inline __attribute__((__warn_unused_result__)) bool meshlink_queue_push(meshlink_queue_t *queue, void *data) {
+ meshlink_queue_item_t *item = malloc(sizeof(*item));
+
+ if(!item) {