代码之家  ›  专栏  ›  技术社区  ›  bitbonk

好的班级名称

  •  1
  • bitbonk  · 技术社区  · 14 年前

    /// <summary>
    ///     Enqeues and exectutes actions synchronously on seperated threads using the <see cref="ThreadPool"/>. 
    /// </summary>
    /// <remarks>
    ///     Syncronism is guaranteed on a per-instance base in that each enqued action will be executed
    ///     after the previous action has completed execution for each instance of <see cref="ThreadPoolExectutor" /> 
    /// </remarks>
    internal class ThreadPoolExectutor
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ThreadPoolExectutor"/> class.
        /// </summary>
        /// <param name="capacity">The absolute (not the initial) number of elements that the <see cref="ThreadPoolExectutor"/> can contain.</param>
        public ThreadPoolExectutor(int capacity)
    
        /// <summary>
        /// Occurs when exception occured during execution.
        /// </summary>
        public event EventHandler<ExceptionEventArgs> ExceptionOccurred;
    
        /// <summary>
        /// Enqueues a new action with a single parameter for execution on the thread pool.
        /// </summary>
        /// <param name="action">
        /// The action to enqueue for execution.
        /// </param>
        /// <param name="param">
        /// The parameter for the action.
        /// </param>
        /// <typeparam name="TArg">
        /// The type of the <paramref name="param"/>.
        /// </typeparam>
        public void Execute<TArg>(Action<TArg> action, TArg param)
    
        /// <summary>
        /// Enqueues a new action with no parameters for execution on the thread pool.
        /// </summary>
        /// <param name="action">
        /// The action to enqueue for execution.
        /// </param>
        public void Execute(Action action)
    }
    
    4 回复  |  直到 14 年前
        1
  •  5
  •   Andrey    14 年前

    我会叫它 ThreadPoolDispatcher

        2
  •  1
  •   stack72    14 年前

    我个人会尝试将类重构成两个较小的类,以遵循单一责任主体-因此有一个类来执行操作

    ThreadPoolDispatcher[根据我同意的上述建议]

    ThreadPoolQueuer

    只是个人喜好而已

        3
  •  0
  •   Chris    14 年前

    怎么样 ThreadPoolAgent .

        4
  •  -2
  •   nrocha    14 年前

    我会说出它的名字 ThreadPoolManager

    推荐文章