コード例 #1
0
        /// <summary>
        /// Creates and starts a new asynchronous <see cref="DelayedCall"/> instance. The callback
        /// function will be invoked on a ThreadPool thread.
        /// </summary>
        /// <param name="cb">The callback function.</param>
        /// <param name="milliseconds">Time to callback invocation in milliseconds.</param>
        /// <returns>The created <see cref="DelayedCall"/> instance that can be used for later controlling of the invocation process.</returns>
        public static DelayedCall StartAsync(Callback cb, int milliseconds)
        {
            DelayedCall dc = CreateAsync(cb, milliseconds);

            if (milliseconds > 0)
            {
                dc.Start();
            }
            else if (milliseconds == 0)
            {
                dc.FireNow();
            }
            return(dc);
        }