Defer busname ownership until init complete
Avoid race conditions where applications expecting an object to be
present upon recipt of NameOwnerChanged find that the object hasn't
been created yet.
Change-Id: I4236a3898055a84b00e1eaf37f32e0192b683a0f
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/pyfanctl/fan_control.py b/pyfanctl/fan_control.py
index cea2215..bccfe50 100644
--- a/pyfanctl/fan_control.py
+++ b/pyfanctl/fan_control.py
@@ -50,11 +50,11 @@
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = get_dbus()
- name = dbus.service.BusName(DBUS_NAME,bus)
fan_control = FanControl(bus,OBJ_PATH)
mainloop = gobject.MainLoop()
print "Starting fan control"
fan_control.setMax()
+ name = dbus.service.BusName(DBUS_NAME,bus)
mainloop.run()