summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/sd-event.c
AgeCommit message (Collapse)Author
2013-11-20event: don't disarm invalid timerfdLennart Poettering
2013-11-20event: whenever a time source changes pending state reshuffle elapsation prioqsLennart Poettering
2013-11-20event: when we change the io events to watch we need to figure out if a an ↵Lennart Poettering
event is pending again
2013-11-20sd-event: fix comparison functionsLennart Poettering
2013-11-20core: convert PID 1 to libsystemd-busLennart Poettering
This patch converts PID 1 to libsystemd-bus and thus drops the dependency on libdbus. The only remaining code using libdbus is a test case that validates our bus marshalling against libdbus' marshalling, and this dependency can be turned off. This patch also adds a couple of things to libsystem-bus, that are necessary to make the port work: - Synthesizing of "Disconnected" messages when bus connections are severed. - Support for attaching multiple vtables for the same interface on the same path. This patch also fixes the SetDefaultTarget() and GetDefaultTarget() bus calls which used an inappropriate signature. As a side effect we will now generate PropertiesChanged messages which carry property contents, rather than just invalidation information.
2013-11-20event: clear pending-state when re-arming timersDavid Herrmann
If a timer fires and is marked pending, but an application re-arms it before it is dispatched, we now clear the pending state. This fixes a bug where an application arms a timer, which fires and is marked pending. But before it is dispatched, the application loses interest in it and disables it. Now if the timer is re-armed and re-enabled later, it will be immediately dispatched as it is still marked pending. This behavior is unexpected, so avoid it by clearing pending state when re-arming timers. Note that applications have no way to clear pending state themselves, so there's no current workaround.
2013-11-12bus: introduce concept of a default bus for each thread and make use of it ↵Lennart Poettering
everywhere We want to emphasize bus connections as per-thread communication primitives, hence introduce a concept of a per-thread default bus, and make use of it everywhere.
2013-11-12bus: introduce concept of a "default" event loop per-thread and make use of ↵Lennart Poettering
it everywhere Try to emphasize a bit that there should be a mapping between event loops and threads, hence introduce a logic that there's one "default" event loop for each thread, that can be queried via "sd_event_default()".
2013-11-07event: make sure we keep a reference to all events we dispatch while we do so.Lennart Poettering
2013-11-06bus: add public libsystemd-eventZbigniew Jędrzejewski-Szmek
2013-10-21sd-event: EPOLLONESHOT only disables event reporting after an event. The fd ↵David Strauss
is still registered.
2013-10-17sd-event: initialize return valueDave Reisner
src/libsystemd-bus/sd-event.c:1597:13: warning: 'r' may be used uninitialized in this function [-Wmaybe-uninitialized]
2013-10-16event: handle arbitrary signals received during epoll gracefullyLennart Poettering
2013-10-16event: properly disarm timers when we don't need them anymoreLennart Poettering
2013-10-16event: fix sd_event_source_set_io_events()Lennart Poettering
2013-10-13event: avoid derefencing null pointerZbigniew Jędrzejewski-Szmek
2013-10-11event: add apis to query the timestamp of the event currently processedLennart Poettering
2013-10-11event: move all library calls over to new assert_return() macroLennart Poettering
2013-10-11event: add sd_event_source_get_child_pid() call to query the PID of a child ↵Lennart Poettering
event source
2013-10-11event: rename the "mute" field of event sources to "enabled"Lennart Poettering
In addition, the states "UNMUTED" and "MUTED" become "ON" and "OFF". This has the benefit that a possible value of this field is not identical to its name, thus minimizing confusion.
2013-10-11event: implement quit handlersLennart Poettering
Quit handlers are executed when an event loop is terminated via sd_event_request_quit(). They are in a way atexit() handlers that are executed in a well-defined environment, time and thread: from the event loop thread when the event loop finishes.
2013-10-10event: refuse operation if the caller tries to reuse an event loop after a ↵Lennart Poettering
fork()
2013-10-10event: add timer accuracy/coalescing logicLennart Poettering
In order to improve energy consumption we should minimize our wake-ups when handling timers. Hence, for each timer take an accuracy value and schedule the actual wake-up time somewhere between the specified time and the specified timer plus the accuracy. The specified time of timer event sources hence becomes the time the handler is called the *earliest*, and the specified time plus the accuracy the time by which it is called the *latest*, leaving the library the freedom to schedule the wake-up somewhere inbetween. If the accuracy is specified as 0 the default of 250ms will be used. When scheduling timeouts we will now try to elapse them at the same point within each second, across the entire system. We do this by using a fixed perturbation value keyed off the boot id. If this point within a second is not in the acceptable range, we try again with a fixed time within each 250ms time step. If that doesn't work either, we wake up at the last possible time.
2013-10-10bus: fix duplicate comparisonsTero Roponen
Testing for y > x is the same as testing for x < y.
2013-10-10bus: add minimal event loop APILennart Poettering
So far we tried to use epoll directly wherever we needed an event loop. However, that has various shortcomings, such as the inability to handle larger amounts of timers (since each timerfd costs one fd, which is a very limited resource, usually bounded to 1024), and inability to do priorisation between multiple queued events. Let's add a minimal event loop API around epoll that is suitable for implementation of our own daemons and maybe one day can become public API for those who desire it. This loop is part of libsystemd-bus, but may be used independently of it.