]> git.meshlink.io Git - meshlink/blobdiff - src/meshlink_queue.h
Allow Catta to be disabled.
[meshlink] / src / meshlink_queue.h
index a1f2524e87a8e8367042e1f3d2ca1598d9c39d0f..511d0b3ccf5c52b72bed6a0a02c54b09a25ea65a 100644 (file)
@@ -1,6 +1,9 @@
+#ifndef MESHLINK_QUEUE_H
+#define MESHLINK_QUEUE_H
+
 /*
     queue.h -- Thread-safe queue
-    Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+    Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef MESHLINK_QUEUE_H
-#define MESHLINK_QUEUE_H
-
 #include <pthread.h>
 #include <stdbool.h>
 #include <stddef.h>
 #include <unistd.h>
 
 typedef struct meshlink_queue {
-       struct meshlink_queue_item *head;       
-       struct meshlink_queue_item *tail;       
+       struct meshlink_queue_item *head;
+       struct meshlink_queue_item *tail;
        pthread_mutex_t mutex;
 } meshlink_queue_t;
 
@@ -38,7 +38,6 @@ typedef struct meshlink_queue_item {
 
 static inline bool meshlink_queue_push(meshlink_queue_t *queue, void *data) {
        meshlink_queue_item_t *item = malloc(sizeof *item);
-       fprintf(stderr, "Pushing %p %p %p\n", queue, item, data);
        if(!item)
                return false;
        item->data = data;
@@ -63,7 +62,6 @@ static inline void *meshlink_queue_pop(meshlink_queue_t *queue) {
        }
        pthread_mutex_unlock(&queue->mutex);
        data = item ? item->data : NULL;
-       fprintf(stderr, "Popping %p %p %p\n", queue, item, data);
        free(item);
        return data;
 }