什么是处理程序?

发布于 2024-07-06 09:17:27 字数 1455 浏览 4 评论 0原文

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

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

发布评论

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

评论(3

爱的那么颓废 2024-07-13 09:17:28

我认为这是一个非常笼统的术语,没有“硬”定义。 其含义与上下文高度相关,根据一般代码设计而有所不同。

对我来说,它通常意味着从内核调用一些代码,并且应该执行一些操作并返回。 该“内部”部分可以有多个可用的“处理程序”,并选择调用哪一个。

在某些情况下,您定义一些 API 以使这些处理程序大部分可以互换,因此调用者可以从表中选择一个并使用相同的代码来调用其中任何一个。 OOP 在这里有很大帮助。

I think it's a very general term, without a 'hard' definition. The meaning is highly contextual, varies depending on the general code design.

For me, it usually means some code that is called from an inner core and is supposed to do some things and return. That 'inner' part can have several 'handlers' available, and chooses which one to call.

In some cases, you define some API to make those handlers mostly interchangeable, so the caller can pick one from a table and use the same code to call any of them. OOP helps a lot here.

旧人 2024-07-13 09:17:27

处理程序是专门处理某种类型的数据或专注于某些特殊任务的例程/函数/方法。

示例:

  • 事件处理程序 - 接收并消化来自
    周围系统(例如操作系统或 GUI)。

  • 内存处理程序 - 在内存上执行某些特殊任务。

  • 文件输入处理程序 - 接收文件输入并执行的函数
    数据上的特殊任务,当然都取决于上下文。

A handler is a routine/function/method which is specialized in a certain type of data or focused on certain special tasks.

Examples:

  • Event handler - Receives and digests events and signals from the
    surrounding system (e.g. OS or GUI).

  • Memory handler - Performs certain special tasks on memory.

  • File input handler - A function receiving file input and performing
    special tasks on the data, all depending on context of course.

和影子一齐双人舞 2024-07-13 09:17:27

与特定事件的发生相关联并由其触发的代码,例如传入消息、引发的异常、发送到进程的信号、网络 I/O 请求完成或用户界面元素上的鼠标单击。 这是一个非常通用的术语。

Code that's associated with and triggered by the occurrence of a specific event, like an incoming message, a thrown exception, a signal sent to a process, a network I/O request completing, or a mouse click on a user interface element. It's a very generic term.

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