/* We attach libsystemd's mainloop to Soletta's on the first time we need to * connect to the bus. Any fail on getting connected to the bus means the * mainloop terminates. */ SOL_API sd_bus * sol_bus_get(void (*bus_initialized)(sd_bus *bus)) { int r; if (_ctx.bus) return _ctx.bus; if (!_ctx.mainloop_source) { r = event_attach_mainloop(); SOL_INT_CHECK_GOTO(r, < 0, fail); }
/* We attach libsystemd's mainloop to Soletta's on the first time we need to * connect to the bus. Any fail on getting connected to the bus means the * mainloop terminates. */ SOL_API sd_bus * sol_bus_get(int (*bus_initialized)(sd_bus *bus)) { int r; if (!_ctx.bus) { if (!_ctx.mainloop_source) { r = event_attach_mainloop(); SOL_INT_CHECK_GOTO(r, < 0, fail); } r = connect_bus(); SOL_INT_CHECK_GOTO(r, < 0, fail); sol_ptr_vector_init(&_ctx.clients); }