Handle for currently open method calls.
Class DBusPendingCall
This class is returned by DBus.invoke and cannot be directly instantiated.
Methods | |
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. |
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.
Checks if a pending call has completed.
DBusPendingCall.completed( [dispatch] )
dispatch | set to true to force dispatching of messages (and state refresh). |
Return | 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 for a pending call to complete and returns the remote method result.
DBusPendingCall.wait()
Return | An item or an array of items returned by the remote method. | ||
Raise |
|
This method is blocking (and currently not respecting VM interruption protocol).