summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2007-03-27 01:35:49 -0400
committerDavid Zeuthen <davidz@redhat.com>2007-03-27 01:35:49 -0400
commit583de1e89c8043180814921c860f85c4cd9ed58b (patch)
treefda549e85bbfb92f03e8137a670612e3869d3c04
parent6c4e1b748beba80a564262c9b877803833b851aa (diff)
fix up ReleaseGlobalInterfaceLock() and improve locking example
-rwxr-xr-xexamples/interface-locking-test.py9
-rw-r--r--hald/hald_dbus.c2
2 files changed, 9 insertions, 2 deletions
diff --git a/examples/interface-locking-test.py b/examples/interface-locking-test.py
index a31a4be2..3b98cd1f 100755
--- a/examples/interface-locking-test.py
+++ b/examples/interface-locking-test.py
@@ -12,7 +12,14 @@ manager = dbus.Interface(bus.get_object("org.freedesktop.Hal",
"/org/freedesktop/Hal/Manager"),
"org.freedesktop.Hal.Manager")
+# replace this with a volume on your system
+device = dbus.Interface(bus.get_object("org.freedesktop.Hal",
+ "/org/freedesktop/Hal/devices/volume_uuid_2232_1F11"),
+ "org.freedesktop.Hal.Device")
+
manager.AcquireGlobalInterfaceLock("org.freedesktop.Hal.Device.Storage", True)
-time.sleep(10)
+#device.AcquireInterfaceLock("org.freedesktop.Hal.Device.Volume", True)
+time.sleep(2)
manager.ReleaseGlobalInterfaceLock("org.freedesktop.Hal.Device.Storage")
+#device.ReleaseInterfaceLock("org.freedesktop.Hal.Device.Volume")
diff --git a/hald/hald_dbus.c b/hald/hald_dbus.c
index 8a6fdad9..a1a2b66b 100644
--- a/hald/hald_dbus.c
+++ b/hald/hald_dbus.c
@@ -2159,7 +2159,7 @@ device_release_global_interface_lock (DBusConnection *connection, DBusMessage *m
}
lock_name = g_strdup_printf ("Global.%s", interface_name);
- if (!hal_device_release_lock (d, interface_name, sender)) {
+ if (!hal_device_release_lock (d, lock_name, sender)) {
raise_interface_not_locked (connection, message, interface_name);
g_free (lock_name);
return DBUS_HANDLER_RESULT_HANDLED;