+ pthread_t run_tid;
+
+ while (1) {
+ pthread_mutex_lock(&exec_lock);
+ list_for_each_entry_safe(loop_msg, tmp_msg, &exec_list, list) {
+ msg = running_with_devpath(loop_msg);
+ if (msg == NULL) {
+ /* move event to run list */
+ pthread_mutex_lock(&running_lock);
+ list_move_tail(&loop_msg->list, &running_list);
+ pthread_mutex_unlock(&running_lock);
+
+ pthread_create(&run_tid, &thr_attr, run_threads, (void *) loop_msg);
+
+ dbg("moved seq %d to running list", loop_msg->seqnum);
+ } else {
+ dbg("delay seq %d, cause seq %d already working on '%s'",
+ loop_msg->seqnum, msg->seqnum, msg->devpath);
+ }
+ }
+ pthread_mutex_unlock(&exec_lock);
+
+ /* wait for activation, new events or childs coming back */
+ pthread_mutex_lock(&exec_active_lock);
+ pthread_cond_wait(&exec_active, &exec_active_lock);
+ 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);
+ /* signal queue activity to manager */
+ pthread_mutex_lock(&exec_active_lock);
+ pthread_cond_signal(&exec_active);
+ pthread_mutex_unlock(&exec_active_lock);
+}
+
+/* queue management thread handles the timeouts and dispatches the events */
+static void *msg_queue_manager(void * parm)
+{
+ struct hotplug_msg *loop_msg;