diff options
author | Kenny Levinsen <kl@kl.wtf> | 2021-07-08 23:41:09 +0200 |
---|---|---|
committer | Kenny Levinsen <kl@kl.wtf> | 2021-07-08 23:48:30 +0200 |
commit | 7a6d12ff7a4e3e19d6c7c9e0f2d270491168e785 (patch) | |
tree | ce06c2d4c80db8a3a2fe4bbb64cb48f9d736751d /libseat/backend | |
parent | 2204db5531ed16bf32f969645e7177f6118f8a8e (diff) |
libseat/seatd: Return executed events
Dispatch needs to report if something has happened, which includes
events executed from the queue as these could have lead to additional
dispatch and queuing.
Diffstat (limited to 'libseat/backend')
-rw-r--r-- | libseat/backend/seatd.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libseat/backend/seatd.c b/libseat/backend/seatd.c index 07026ba..9bc5e6e 100644 --- a/libseat/backend/seatd.c +++ b/libseat/backend/seatd.c @@ -206,10 +206,11 @@ static int queue_event(struct backend_seatd *backend, int opcode) { return 0; } -static void execute_events(struct backend_seatd *backend) { +static int execute_events(struct backend_seatd *backend) { struct linked_list list; linked_list_init(&list); linked_list_take(&list, &backend->pending_events); + int executed = 0; while (!linked_list_empty(&list)) { struct pending_event *ev = (struct pending_event *)list.next; int opcode = ev->opcode; @@ -231,7 +232,9 @@ static void execute_events(struct backend_seatd *backend) { log_errorf("Invalid opcode: %d", opcode); abort(); } + executed++; } + return executed; } static int dispatch_pending(struct backend_seatd *backend, int *opcode) { @@ -341,7 +344,7 @@ static int dispatch_background(struct libseat *base, int timeout) { return -1; } - execute_events(backend); + dispatched += execute_events(backend); return dispatched; } |