chiark / gitweb /
[PATCH] udevd - allow to bypass sequence number
[elogind.git] / udevd.c
diff --git a/udevd.c b/udevd.c
index 331b7e4b84aa9d0229f709268dcbe58248e88701..f8b8c27ee4ad51a0f6679aa7e71969247035198a 100644 (file)
--- a/udevd.c
+++ b/udevd.c
@@ -205,16 +205,20 @@ static void *exec_queue_manager(void * parm)
        }
 }
 
-/* move message from incoming to exec queue */
-static void msg_move_exec(struct list_head *head)
+static void exec_queue_activate(void)
 {
-       list_move_tail(head, &exec_list);
-       /* signal queue activity to manager */
        pthread_mutex_lock(&exec_active_lock);
        pthread_cond_signal(&exec_active);
        pthread_mutex_unlock(&exec_active_lock);
 }
 
+/* move message from incoming to exec queue */
+static void msg_move_exec(struct list_head *head)
+{
+       list_move_tail(head, &exec_list);
+       exec_queue_activate();
+}
+
 /* queue management thread handles the timeouts and dispatches the events */
 static void *msg_queue_manager(void * parm)
 {
@@ -298,9 +302,17 @@ static void *client_threads(void * parm)
                goto exit;
        }
 
-       pthread_mutex_lock(&msg_lock);
-       msg_queue_insert(msg);
-       pthread_mutex_unlock(&msg_lock);
+       /* if no seqnum is given, we move straight to exec queue */
+       if (msg->seqnum == 0) {
+               pthread_mutex_lock(&exec_lock);
+               list_add(&msg->list, &exec_list);
+               exec_queue_activate();
+               pthread_mutex_unlock(&exec_lock);
+       } else {
+               pthread_mutex_lock(&msg_lock);
+               msg_queue_insert(msg);
+               pthread_mutex_unlock(&msg_lock);
+       }
 
 exit:
        close(sock);