]> git.meshlink.io Git - catta/commitdiff
process change events in the order they are received
authorSven M. Hallberg <pesco@khjk.org>
Thu, 11 Sep 2014 19:53:02 +0000 (21:53 +0200)
committerSven M. Hallberg <pesco@khjk.org>
Thu, 11 Sep 2014 19:53:02 +0000 (21:53 +0200)
include/catta/llist.h
src/iface-windows.c

index a2321b6a551a591bb92264a224359410c71ad720..59a72742d3219dfa03b72e8c7d0588b80c858be9 100644 (file)
@@ -55,6 +55,17 @@ CATTA_C_DECL_BEGIN
                                         *_head = _item; \
                                         } while (0)
 
+/** Append an item to the list */
+#define CATTA_LLIST_APPEND(t,name,head,item) do { \
+        t **_cur = &(head), *_prev, *_item = (item); \
+        assert(_item); \
+        while ((_prev = *_cur)) \
+            _cur = &_prev->name##_next; \
+        _item->name##_prev = _prev; \
+        _item->name##_next = NULL; \
+        *_cur = _item; \
+    } while (0)
+
 /** Remove an item from the list */
 #define CATTA_LLIST_REMOVE(t,name,head,item) do { \
                                     t **_head = &(head), *_item = (item); \
index c62e96a31f7c980ff56bb9d1944701e8a2c7e721..b2b96a15e77087e1ea128be196e06bb0a584fc56 100644 (file)
@@ -217,8 +217,7 @@ static void queue_event(CattaInterfaceMonitor *m, ChangeEvent *ev)
 
     if(!pthread_mutex_lock(&m->osdep.mutex)) {
         // queue the event
-        // XXX event ordering!!
-        CATTA_LLIST_PREPEND(ChangeEvent, event, m->osdep.events, ev);
+        CATTA_LLIST_APPEND(ChangeEvent, event, m->osdep.events, ev);
 
         // wake the handler
         writepipe(m->osdep.pipefd[1], &c, sizeof(c));