Class DBusPendingCall

Handle for currently open method calls.

class DBusPendingCall

more...

Summary

cancel()Cancels a pending call.
completed()Checks if a pending call has completed.
wait()Wait for a pending call to complete and returns the remote method result.

Detailed description

Handle for currently open method calls.

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

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] )

dispatchset to true to force dispatching of messages (and state refresh).
Returns:True 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( )

Returns:An item or an array of items returned by the remote method.
Raises:
DBusErrorif 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 faldoc 2.1.0