]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-event: refuse running default event loops in any other thread than the one they... 13886/head
authorLennart Poettering <lennart@poettering.net>
Wed, 30 Oct 2019 19:26:50 +0000 (20:26 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 4 Dec 2019 09:36:28 +0000 (10:36 +0100)
TODO
src/libsystemd/sd-event/sd-event.c

diff --git a/TODO b/TODO
index 88fd9d7f10615d1d2eeab3fbd193c9d1d7f60347..07f65ec80e967d5d46ae015dd5d6b443c6169cb7 100644 (file)
--- a/TODO
+++ b/TODO
@@ -701,7 +701,6 @@ Features:
   - allow multiple signal handlers per signal?
   - document chaining of signal handler for SIGCHLD and child handlers
   - define more intervals where we will shift wakeup intervals around in, 1h, 6h, 24h, ...
-  - generate a failure of a default event loop is executed out-of-thread
 
 * investigate endianness issues of UUID vs. GUID
 
index 8d4a20e420fbbef43bffc6ef448d5bb376bafbae..4940345791149d1226d885a5677a1d70b27ee928 100644 (file)
@@ -3422,6 +3422,11 @@ _public_ int sd_event_prepare(sd_event *e) {
         assert_return(e->state != SD_EVENT_FINISHED, -ESTALE);
         assert_return(e->state == SD_EVENT_INITIAL, -EBUSY);
 
+        /* Let's check that if we are a default event loop we are executed in the correct thread. We only do
+         * this check here once, since gettid() is typically not cached, and thus want to minimize
+         * syscalls */
+        assert_return(!e->default_event_ptr || e->tid == gettid(), -EREMOTEIO);
+
         if (e->exit_requested)
                 goto pending;