src/Cassandra/OperationState.cs
/// <summary>
/// Marks this operation as timed-out, callbacks with the exception 
/// and sets a handler when the response is received
/// </summary>
Marks this operation as timed-out, callbacks with the exception
and sets a handler when the response is received
Marks this operation as timed - out callbacks with the exception and sets a handler when the response is received
public bool MarkAsTimedOut(OperationTimedOutException ex, Action onReceive)
        {
            var previousState = Interlocked.CompareExchange(ref _state, StateTimedout, StateInit);
            if (previousState != StateInit)
            {
                return false;
            }
            var callback = Interlocked.Exchange(ref _callback, (_, __) => onReceive());
#if !NETCORE
            Thread.MemoryBarrier();
#else
            Interlocked.MemoryBarrier();
#endif
            _timeoutCallbackSet = true;
            Task.Factory.StartNew(() => callback(ex, null), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default);
            return true;
        }
public bool MarkAsTimedOut ( OperationTimedOutException ex , Action onReceive ) { var previousState = Interlocked . CompareExchange ( ref _state , StateTimedout , StateInit ) ; if ( previousState != StateInit ) { return false ; } var callback = Interlocked . Exchange ( ref _callback , ( _ , __ ) => onReceive ( ) ) ; if ! NETCORE Thread . MemoryBarrier ( ) ; else Interlocked . MemoryBarrier ( ) ; endif _timeoutCallbackSet = true ; Task . Factory . StartNew ( ( ) => callback ( ex , null ) , CancellationToken . None , TaskCreationOptions . None , TaskScheduler . Default ) ; return true ; }
Marks this operation as timed-out, callbacks with the exception
and sets a handler when the response is received
Marks this operation as timed - out callbacks with the exception and sets a handler when the response is received
//When the data is received, invoke on receive callback
ex
OperationTimedOutException
onReceive
Action