Quantum 3
3.1.0
The operation handler is used to monitor the Photon Realtime operation callbacks for an async task. More...
Inherits IDisposable.
Public Member Functions | |
| AsyncOperationHandler () | |
| Create a new operation handler without a timeout. More... | |
| AsyncOperationHandler (float operationTimeoutSec) | |
| Create a new operation handler with a timeout. More... | |
| void | Dispose () |
| Dispose the handler and dispose all its Disposables. More... | |
| void | SetException (Exception e) |
| Set an exception as result and complete the operation handler. More... | |
| void | SetResult (short result) |
| Set the result and complete the operation handler. More... | |
Public Attributes | |
| TaskCompletionSource< short > | CompletionSource => _result |
| The completion source to trigger by operation callbacks. More... | |
| bool | IsCancellationRequested => _cancellation == null ? false : _cancellation.IsCancellationRequested |
| Returns if cancellation has been requested. More... | |
| Task< short > | Task => _result.Task |
| Returns the task to complete. More... | |
| CancellationToken | Token => _cancellation == null ? CancellationToken.None : _cancellation.Token |
| The cancellation token for the operation timeout, will return CancellationToken.None if no timeout is set. More... | |
Properties | |
| ConcurrentQueue< IDisposable > | Disposables [get] |
| A collection of additional objects or callbacks that need to be disposed once the operation handler is done. For example subscriptions to RealtimeClient.CallbackMessage. More... | |
| string | Name [get, set] |
| The name of the operation handler, only set in DEBUG build configuration. More... | |
The operation handler is used to monitor the Photon Realtime operation callbacks for an async task.
The handler completes its task from inside the client's dispatch (i.e. while the peer holds its dispatch lock). The completion source therefore uses RunContinuationsAsynchronously: awaiting code is never run inline on the dispatching thread, so it can't deadlock by (synchronously) waiting for something that needs the dispatch lock (e.g. Disconnect(), Connect() or another Service() call). Exception: Unity WebGL, as it's single threaded anyways.
|
inline |
Create a new operation handler with a timeout.
A timeout only faults the Task. Without a service task (AsyncExtensions.CreateServiceTask), dispose the handler yourself.
| operationTimeoutSec | Operation timeout in seconds. |
|
inline |
Create a new operation handler without a timeout.
|
inline |
Set the result and complete the operation handler.
| result | Result. |
|
inline |
Set an exception as result and complete the operation handler.
| e | Exception to raise. |
|
inline |
Dispose the handler and dispose all its Disposables.
| Task<short> Photon.Realtime.AsyncOperationHandler.Task => _result.Task |
Returns the task to complete.
| TaskCompletionSource<short> Photon.Realtime.AsyncOperationHandler.CompletionSource => _result |
The completion source to trigger by operation callbacks.
| CancellationToken Photon.Realtime.AsyncOperationHandler.Token => _cancellation == null ? CancellationToken.None : _cancellation.Token |
The cancellation token for the operation timeout, will return CancellationToken.None if no timeout is set.
| bool Photon.Realtime.AsyncOperationHandler.IsCancellationRequested => _cancellation == null ? false : _cancellation.IsCancellationRequested |
Returns if cancellation has been requested.
|
get |
A collection of additional objects or callbacks that need to be disposed once the operation handler is done. For example subscriptions to RealtimeClient.CallbackMessage.
|
getset |
The name of the operation handler, only set in DEBUG build configuration.