Skip to content

Run the long-running D-Bus monitors on EventLoop - #24

Merged
jwinarske merged 1 commit into
mainfrom
jw/eventloop-all-clients
Jul 12, 2026
Merged

Run the long-running D-Bus monitors on EventLoop#24
jwinarske merged 1 commit into
mainfrom
jw/eventloop-all-clients

Conversation

@jwinarske

@jwinarske jwinarske commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Run the long-running D-Bus monitors on EventLoop

Migrate the pure-D-Bus monitor clients from enterEventLoopAsync() + monitorLoop() to the single-threaded EventLoop + SignalSource, matching the BlueZ clients. Each now drives its connection on the main thread and shuts down synchronously via the loop's signalfd instead of a bus-owned thread plus a 100ms poll.

Migrated: bluez, geoclue2, login1, network1, networkmanager, resolve1, systemd1, udisks2, udisks2_monitor_daemon, upower, wpa_supplicant.

Not migrated, by design:

  • connman keeps its reconnect-with-exponential-backoff model. Its lifecycle needs to stay responsive to SIGINT/SIGTERM while the system bus is down (before a connection exists), which the signalfd-only model can't do without a bus-less run() variant; the existing installSignalHandlers()/g_running path handles that correctly.
  • The one-shot clients that fetch and exit (avahi, flatpak, fwupd, hostname1,
    locale1, packagekit, timedate1) and the synchronous examples (realtimekit1, timesync1) are not long-running loops; running them under EventLoop would turn a fetch-and-exit into a daemon.

Verified at runtime: login1 and systemd1 start, drive their D-Bus callbacks on
the loop, and exit cleanly on SIGTERM. Full build green; clang-format --Werror and clang-tidy-19 clean.

Migrate the pure-D-Bus monitor clients from enterEventLoopAsync() + monitorLoop()
to the single-threaded EventLoop + SignalSource, matching the BlueZ clients. Each
now drives its connection on the main thread and shuts down synchronously via the
loop's signalfd instead of a bus-owned thread plus a 100ms poll.

Migrated: bluez, geoclue2, login1, network1, networkmanager, resolve1, systemd1,
udisks2, udisks2_monitor_daemon, upower, wpa_supplicant.

Not migrated, by design:
- connman keeps its reconnect-with-exponential-backoff model. Its lifecycle
  needs to stay responsive to SIGINT/SIGTERM while the system bus is down (before
  a connection exists), which the signalfd-only model can't do without a
  bus-less run() variant; the existing installSignalHandlers()/g_running path
  handles that correctly.
- The one-shot clients that fetch and exit (avahi, flatpak, fwupd, hostname1,
  locale1, packagekit, timedate1) and the synchronous examples (realtimekit1,
  timesync1) are not long-running loops; running them under EventLoop would turn
  a fetch-and-exit into a daemon.

Verified at runtime: login1 and systemd1 start, drive their D-Bus callbacks on
the loop, and exit cleanly on SIGTERM. Full build green; clang-format --Werror
and clang-tidy-19 clean.

Signed-off-by: Joel Winarske <[email protected]>
@jwinarske
jwinarske merged commit dce9a2e into main Jul 12, 2026
6 checks passed
@jwinarske
jwinarske deleted the jw/eventloop-all-clients branch July 12, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant