Exemple #1
0
        /// <summary>
        /// Closes a pool.
        /// </summary>
        /// <param name="poolHandle">The handle of the pool to close.</param>
        /// <returns>An asynchronous Task with no return value.</returns>
        private static Task ClosePoolLedgerAsync(IntPtr poolHandle)
        {
            var taskCompletionSource = new TaskCompletionSource <bool>();
            var commandHandle        = AddTaskCompletionSource(taskCompletionSource);

            var result = IndyNativeMethods.indy_close_pool_ledger(
                commandHandle,
                poolHandle,
                _noValueCallback
                );

            CheckResult(result);

            return(taskCompletionSource.Task);
        }
Exemple #2
0
        /// <summary>
        /// Closes the pool.
        /// </summary>
        /// <remarks>
        /// <note type="note">Once a Pool instance is closed it cannot be opened again.  Instead call the
        /// <see cref="OpenPoolLedgerAsync(string, string)"/> method to open a new Pool instance.</note>
        /// </remarks>
        /// <returns>An asynchronous <see cref="Task"/> that completes when the operation completes.</returns>
        public Task CloseAsync()
        {
            var taskCompletionSource = new TaskCompletionSource <bool>();
            var commandHandle        = PendingCommands.Add(taskCompletionSource);

            var result = IndyNativeMethods.indy_close_pool_ledger(
                commandHandle,
                Handle,
                CallbackHelper.TaskCompletingNoValueCallback
                );

            CallbackHelper.CheckResult(result);

            _closeRequested = true;
            GC.SuppressFinalize(this);

            return(taskCompletionSource.Task);
        }