public static IAsyncResult BeginOperation(AsyncCall call, AsyncCallback callback, object state) { DynamoDBAsyncResult result = new DynamoDBAsyncResult(callback, state); ThreadPool.QueueUserWorkItem(s => Execute(call, result)); return(result); }
public static IAsyncResult BeginOperation(AsyncCall call, AsyncCallback callback, object state) { DynamoDBAsyncResult result = new DynamoDBAsyncResult(callback, state); new Thread(() => Execute(call, result)).Start(); return(result); }
public static void Execute(AsyncCall call, DynamoDBAsyncResult result) { try { result.Return = call(); } catch (Exception e) { result.LastException = e; result.Return = null; } finally { result.SignalWaitHandle(); if (result.Callback != null) { result.Callback(result); } } }
public static object EndOperation(IAsyncResult result) { DynamoDBAsyncResult asyncResult = result as DynamoDBAsyncResult; if (asyncResult == null) { return(null); } if (!asyncResult.CompletedSynchronously) { WaitHandle.WaitAll(new WaitHandle[] { asyncResult.AsyncWaitHandle }); } if (asyncResult.LastException != null) { AWSSDKUtils.PreserveStackTrace(asyncResult.LastException); throw asyncResult.LastException; } return(asyncResult.Return); }
public static IAsyncResult BeginOperation(AsyncCall call, AsyncCallback callback, object state) { DynamoDBAsyncResult result = new DynamoDBAsyncResult(callback, state); ThreadPool.QueueUserWorkItem(s => Execute(call, result)); return result; }
public static IAsyncResult BeginOperation(AsyncCall call, AsyncCallback callback, object state) { DynamoDBAsyncResult result = new DynamoDBAsyncResult(callback, state); new Thread(() => Execute(call, result)).Start(); return result; }