Merge "app_queue.c: Extract some functions for simpler code."