static object endOperation(IAsyncResult result)
        {
            TransferAsyncResult transferAsyncResult = result as TransferAsyncResult;

            if (transferAsyncResult == null)
            {
                return(null);
            }

            using (transferAsyncResult)
            {
                if (!transferAsyncResult.CompletedSynchronously)
                {
                    WaitHandle.WaitAll(new WaitHandle[] { transferAsyncResult.AsyncWaitHandle });
                }

                if (transferAsyncResult.LastException != null)
                {
                    AWSSDKUtils.PreserveStackTrace(transferAsyncResult.LastException);
                    throw transferAsyncResult.LastException;
                }

                return(transferAsyncResult.Return);
            }
        }
        IAsyncResult beginOperation(BaseCommand command, AsyncCallback callback, object state)
        {
            TransferAsyncResult result = new TransferAsyncResult(callback, state);

            Executer exe = new Executer(result, command);

            ThreadPool.QueueUserWorkItem(s => exe.Execute());

            return(result);
        }
        IAsyncResult beginOperation(BaseCommand command, AsyncCallback callback, object state)
        {
            TransferAsyncResult result = new TransferAsyncResult(callback, state);

            Executer exe    = new Executer(result, command);
            Thread   thread = new Thread(new ThreadStart(exe.Execute));

            thread.Start();

            return(result);
        }
 private Executer(TransferAsyncResult asyncResult, BaseCommand command)
 {
     this._asyncResult = asyncResult;
     this._command     = command;
 }