Class Eina.Promise
Promises act as placeholders for a value that may be available in the future.
With a Promise you can attach futures to it, which will be used to notify of the value being available.
Constructors
Promise(Promise.CancelCb)
Creates a new Promise with the given callback.
Currently, creating a promise directly uses the Main Loop scheduler the source of notifications (i.e. the future callbacks will be called mainly from a loop iteration).
Declaration
public Promise(Promise.CancelCb cancelCb = null)
Parameters
Type | Name | Description |
---|---|---|
Eina.Promise.CancelCb | cancelCb |
Methods
Dispose()
Dispose this promise, causing its cancellation if it isn't already fulfilled.
Declaration
public void Dispose()
Dispose(Boolean)
Disposes of this wrapper, rejecting the native promise with Eina.Error.ECANCELED
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | True if this was called from Eina.Promise.Dispose() public method. False if called from the C# finalizer. |
Finalize()
Finalizer to be called from the Garbage Collector.
Declaration
protected void Finalize()
Reject(Error)
Rejects a promise.
The future chain attached to this promise will be called with an Eina.Value of type Eina.ValueType.Error and payload Eina.Error.ECANCELED.
Declaration
public void Reject(Error reason)
Parameters
Type | Name | Description |
---|---|---|
Eina.Error | reason |
Resolve(Value)
Fulfills a promise with the given value.
This will make all futures attached to it to be called with the given value as payload.
Declaration
public void Resolve(Value value)
Parameters
Type | Name | Description |
---|---|---|
Eina.Value | value |