Mercurial > emacs
comparison lisp/net/dbus.el @ 104602:d74b934b16e5
* net/dbus.el (dbus-ping): Add optional parameter TIMEOUT.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Tue, 25 Aug 2009 10:13:54 +0000 |
parents | 20810cc73f89 |
children | 2b4cc3e45a7b |
comparison
equal
deleted
inserted
replaced
104601:3f203311bcc1 | 104602:d74b934b16e5 |
---|---|
491 (dbus-ignore-errors | 491 (dbus-ignore-errors |
492 (dbus-call-method | 492 (dbus-call-method |
493 bus dbus-service-dbus dbus-path-dbus | 493 bus dbus-service-dbus dbus-path-dbus |
494 dbus-interface-dbus "GetNameOwner" service))) | 494 dbus-interface-dbus "GetNameOwner" service))) |
495 | 495 |
496 (defun dbus-ping (bus service) | 496 (defun dbus-ping (bus service &optional timeout) |
497 "Check whether SERVICE is registered for D-Bus BUS." | 497 "Check whether SERVICE is registered for D-Bus BUS. |
498 TIMEOUT, a nonnegative integer, specifies the maximum number of | |
499 milliseconds `dbus-ping' must return. The default value is 25,000. | |
500 | |
501 Note, that this autoloads SERVICE if it is not running yet. If | |
502 it shall be checked whether SERVICE is already running, one shall | |
503 apply | |
504 | |
505 \(member service \(dbus-list-known-names bus))" | |
498 ;; "Ping" raises a D-Bus error if SERVICE does not exist. | 506 ;; "Ping" raises a D-Bus error if SERVICE does not exist. |
499 ;; Otherwise, it returns silently with `nil'. | 507 ;; Otherwise, it returns silently with `nil'. |
500 (condition-case nil | 508 (condition-case nil |
501 (not | 509 (not |
502 (dbus-call-method bus service dbus-path-dbus dbus-interface-peer "Ping")) | 510 (if (natnump timeout) |
511 (dbus-call-method | |
512 bus service dbus-path-dbus dbus-interface-peer | |
513 "Ping" :timeout timeout) | |
514 (dbus-call-method | |
515 bus service dbus-path-dbus dbus-interface-peer "Ping"))) | |
503 (dbus-error nil))) | 516 (dbus-error nil))) |
504 | 517 |
505 | 518 |
506 ;;; D-Bus introspection. | 519 ;;; D-Bus introspection. |
507 | 520 |