Revised to use systemd's internal event library.