好班级名的想法

发布于 2024-09-24 18:53:12 字数 1843 浏览 3 评论 0原文

如何命名具有以下公共接口的类:

/// <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)
}

How would you name a class with the following public interface:

/// <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)
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

何其悲哀 2024-10-01 18:53:12

入队并执行操作

我将其称为 ThreadPoolDispatcher

Enqeues and exectutes actions

I would call it ThreadPoolDispatcher

彼岸花ソ最美的依靠 2024-10-01 18:53:12

我个人尝试将类重构为 2 个较小的类,以遵循单一职责原则 - 因此有一个用于执行操作

ThreadPoolDispatcher 的类 [按照我同意的上述建议]

,然后是一个 ThreadPoolQueuer ,它将负责排队线程

只是个人喜好

personally id try and refactor the class into 2 smaller ones to follow the Single Responsibility Principal - therefore have a class for Executing actions

ThreadPoolDispatcher [as per the above suggestion that i agree with]

and then a ThreadPoolQueuer which will be responsible for queuing threads

just personal preference though

烙印 2024-10-01 18:53:12

ThreadPoolAgent怎么样。

How about ThreadPoolAgent.

倥絔 2024-10-01 18:53:12

我将其命名为ThreadPoolManager

I would name it ThreadPoolManager

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文