# HG changeset patch # User Paul Boddie # Date 1655584277 -7200 # Node ID 346941e94fd40c99809d0ac6b9fcadeb5d939a8a # Parent a82b46af7fb4606b81045b557284ea946d6c32e0 Acquire any IRQ label dynamically instead of at the start of the IPC mainloop since the mainloop may have been started in a new thread, and the IRQ may be initialised concurrently in the initiating thread. diff -r a82b46af7fb4 -r 346941e94fd4 libipc/lib/src/server.c --- a/libipc/lib/src/server.c Sat Jun 18 14:15:38 2022 +0200 +++ b/libipc/lib/src/server.c Sat Jun 18 22:31:17 2022 +0200 @@ -212,7 +212,7 @@ long ipc_server_managed_loop(int expected_items, ipc_server_config_type *config) { ipc_message_t msg; - l4_umword_t label, irq_label = (l4_umword_t) config->irq; + l4_umword_t label, irq_label; /* Permit other endpoints by dynamically interpreting the label. */ @@ -225,11 +225,6 @@ if (err) return err; - /* Unmask the interrupt. */ - - if (l4_is_valid_cap(config->irq)) - ipc_init_irq(config->irq); - /* Wait for an incoming message. */ while (1) @@ -247,7 +242,9 @@ /* Message involves the IPC gate itself. */ - if (label != irq_label) + irq_label = (l4_umword_t) config->irq; + + if (!config->notifications || (config->notifications && (label != irq_label))) { config_from_label = (ipc_server_config_type *) label; config_from_label->handler(&msg, config_from_label->handler_obj); @@ -255,7 +252,7 @@ /* Message involves the IRQ or a termination condition occurred. */ - if ((label == irq_label) || msg.terminating) + else if ((config->notifications && (label == irq_label)) || msg.terminating) break; } @@ -383,6 +380,10 @@ if (err) return err; + + /* Unmask the interrupt. */ + + ipc_init_irq(config->irq); } /* With a separate thread, return the last status value. Otherwise, invoke the