Evd.Deferred¶
Fields¶
None
Methods¶
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Evd.Deferred¶
An opaque structure that represents a deferred object.
- classmethod new(source_object, cancellable, tag)¶
- Parameters:
source_object (
GObject.ObjectorNone) – TheGObject.Objectperforming the async operation, orNonecancellable (
Gio.CancellableorNone) – AGio.Cancellableobject, orNonetag (
objectorNone) – An arbitrary pointer identifying the async operation, orNone
- Returns:
A new
Evd.Deferred, to be freed withEvd.Deferred.unref()- Return type:
Creates a new deferred object to track the execution of an asynchronous operation. It works like
Gio.SimpleAsyncResult, but with some important differences.Evd.Deferreddoes not represent itself the result of the asynchronous operation. Instead, it delegates onEvd.Promise, which is aGio.AsyncResult, all the functionality except the ability to set the result and complete the operation. This way, theEvd.Promisecan be made public to the application, while only theEvd.Deferredobject is kept private in the implementation as withGio.SimpleAsyncResult.An
Evd.Deferredand its associatedEvd.Promiseare bound together so that only a deferred object can resolve or reject its associated promise. The promise of a deferred object can be obtained withEvd.Deferred.get_promise().
- complete()¶
Completes the asynchronous operation represented by the deferred object, immediately calling all the listener callbacks added to the associated
Evd.Promiseobject.This method must not be used if the operation is completed on the same event loop cycle. For those cases,
Evd.Deferred.complete_in_idle() is provided.
- complete_in_idle()¶
Works as
Evd.Deferred.complete(), but defers the actual completion to the next event loop cycle.
- get_promise()¶
- Returns:
The
Evd.Promise, owned by the deferred object- Return type:
Retrieves the promise object associated with the deferred.
- ref()¶
- Returns:
The same
Evd.Deferredobject- Return type:
Increases the reference count of the deferred object.
- set_result_boolean(boolean)¶
-
Sets the result of the asynchronous operation as a boolean value.
This method does not completes the operation.
Evd.Deferred.complete() orEvd.Deferred.complete_in_idle() should be called after for that purpose.
- set_result_pointer(data, data_free_func)¶
- Parameters:
data (
objectorNone) – The result of the async operation as aobjectdata_free_func (
GLib.DestroyNotifyorNone) –GLib.DestroyNotifycallback to free data, orNone
Sets the result of the asynchronous operation as an arbitrary pointer of data. data_free_func, if provided, will be called when data is no longer used.
This method does not completes the operation.
Evd.Deferred.complete() orEvd.Deferred.complete_in_idle() should be called after for that purpose.
- set_result_size(size)¶
- Parameters:
size (
int) – The result of the async operation as a gssize
Sets the result of the asynchronous operation as a long signed integer, useful for size results.
This method does not completes the operation.
Evd.Deferred.complete() orEvd.Deferred.complete_in_idle() should be called after for that purpose.
- take_result_error(error)¶
- Parameters:
error (
GLib.Error) – The result of the async operation as aGLib.Error
Sets the result of the asynchronous operation as an error, indicating that the operation failed. The deferred object takes ownership of error.
This method does not completes the operation.
Evd.Deferred.complete() orEvd.Deferred.complete_in_idle() should be called after for that purpose.
- unref()¶
Decreases the reference count of the deferred. If it reaches zero, the object is destroyed and all its memory released.