src/Cassandra/OperationState.cs
/// <summary>
/// Marks this operation as completed and returns the callback.
/// Note that the returned callback might be a reference to <see cref="Noop"/>, as the original callback
/// might be already called.
/// </summary>
Marks this operation as completed and returns the callback.
Note that the returned callback might be a reference to , as the original callback
might be already called.
Marks this operation as completed and returns the callback . Note that the returned callback might be a reference to as the original callback might be already called .
public Action<Exception, Response> SetCompleted()
        {
            var previousState = Interlocked.CompareExchange(ref _state, StateCompleted, StateInit);
            if (previousState == StateCancelled || previousState == StateCompleted)
            {
                return Noop;
            }
            Action<Exception, Response> callback;
            if (previousState == StateInit)
            {
                callback = Interlocked.Exchange(ref _callback, Noop);
                var timeout = _timeout;
                if (timeout != null)
                {
                    timeout.Cancel();
                }
                return callback;
            }
            var spin = new SpinWait();
            while (!_timeoutCallbackSet)
            {
                spin.SpinOnce();
            }
            callback = Interlocked.Exchange(ref _callback, Noop);
            return callback;
        }
public Action < Exception , Response > SetCompleted ( ) { var previousState = Interlocked . CompareExchange ( ref _state , StateCompleted , StateInit ) ; if ( previousState == StateCancelled || previousState == StateCompleted ) { return Noop ; } Action < Exception , Response > callback ; if ( previousState == StateInit ) { callback = Interlocked . Exchange ( ref _callback , Noop ) ; var timeout = _timeout ; if ( timeout != null ) { timeout . Cancel ( ) ; } return callback ; } var spin = new SpinWait ( ) ; while ( ! _timeoutCallbackSet ) { spin . SpinOnce ( ) ; } callback = Interlocked . Exchange ( ref _callback , Noop ) ; return callback ; }
Marks this operation as completed and returns the callback.
Marks this operation as completed and returns the callback .
//Cancel it if it hasn't expired //Operation has timed out //Wait for the timeout callback to be set