<div dir="ltr">Hello folks,<div><br></div><div>I am trying to ensure that my system DBus service has time to handle a DBus method call before it shuts down. My DBus service is implemented as a system systemd service; let's call it service A. It runs a single-threaded, synchronous event loop that listens for DBus method calls and handles them appropriately. This event loop also listens for SIGTERM. When SIGTERM is received, service A currently terminates the event loop, performs any necessary writes to disk, and releases its resources. I am assuming that when the system is shut down cleanly, systemd initially sends SIGTERM to systemd services and only sends SIGKILL to abort it abruptly if it takes too long to shut down when asked nicely.</div><div><br></div><div>I have another system systemd service, call it service B, that runs an event loop listening for SIGTERM. When service B receives a SIGTERM, it makes the aforementioned DBus method call and then flushes the system bus. Service B specifies <a href="http://www.freedesktop.org/software/systemd/man/systemd.unit.html#Requires=">Requires=</a>Service A and <a href="http://www.freedesktop.org/software/systemd/man/systemd.unit.html#Before=">After=</a>Service A. Service A makes no mention of service B in its unit configuration file. Does systemd make any sort of guarantee that service A will get a chance to handle the DBus method call before receiving SIGTERM, or does my code as written have a race condition?</div><div><br></div><div>Be well,</div><div>Kurt<br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><span><span style="font-size:15px;font-family:Arial;color:rgb(183,183,183);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Kurt von Laven | Endless Mobile | 732.784.7356 | </span><a href="http://endlessm.com/" style="text-decoration:none" target="_blank"><span style="font-size:15px;font-family:Arial;color:rgb(183,183,183);text-decoration:underline;vertical-align:baseline;white-space:pre-wrap;background-color:transparent">EndlessM.com</span></a></span><br></div></div>
</div></div>