8.4Class DBusPendingCall

Handle for currently open method calls.

Class DBusPendingCall

This class is returned by DBus.invoke and cannot be directly instantiated.

Methods
cancelCancels a pending call.
completedChecks if a pending call has completed.
waitWait for a pending call to complete and returns the remote method result.

Methods

cancel

Cancels a pending call.

DBusPendingCall.cancel()

Interrupts any wait on this call and notifies the DBUS system (and the other end) that we're not interested anymore in the call.

completed

Checks if a pending call has completed.

DBusPendingCall.completed( [dispatch] )
dispatch set to true to force dispatching of messages (and state refresh).
ReturnTrue if the pending call can be waited on without blocking.

This method can be used to poll periodically to see if an answer has come in the meanwhile.

If the dispatch parameter is not specified, or if it's false, the network is not read again for new incoming data on the DBUS connection. This means a DBus.dispatch method or other DBUS operations must be performed elsewhere for this pending call to be updated and eventually completed. For example:


      while pending.completed()
         ...
         sleep(...)
         conn.dispatch()
      end

If the parameter is set to true a single dispatch loop is performed too. Usually, it takes at least 2 dispatch loops to receive a complete answer.


      while pending.completed( true )
         ...
         sleep(...)
         // no need for conn.dispatch() to be called
      end

wait

Wait for a pending call to complete and returns the remote method result.

DBusPendingCall.wait()
ReturnAn item or an array of items returned by the remote method.
Raise
DBusError if the method call couldn't be performed, of if the remote side returned an error.

This method is blocking (and currently not respecting VM interruption protocol).

Made with http://www.falconpl.org