其他分享
首页 > 其他分享> > handle和handler的理解

handle和handler的理解

作者:互联网

维基百科对handler的解释:

Handler, an asynchronous callback (computer programming) subroutine in computing
...
Event handler, a routine for processing a programming event
Interrupt handler, a routine for processing CPU interrupts
Signal handler, a routine for handling signals sent to a process
Exception handler, a routine for handling software exceptions

维基百科对handle的解释:

In computer programming, a handle is an abstract reference to a resource. 
Handles are used when application software references blocks of memory or 
objects managed by another system, such as a database or an operating system. 
A resource handle can be an opaque identifier, in which case it is often an 
integer number (often an array index in an array or "table" that is used to 
manage that type of resource), or it can be a pointer that allows access to 
further information.

Common resource handles are file descriptors, network sockets, 
database connections, process identifiers (PIDs), and job IDs. 
Process IDs and job IDs are explicitly visible integers, while file descriptors 
and sockets (which are often implemented as a form of file descriptor) are 
represented as integers, but are typically considered opaque. In traditional 
implementations, file descriptors are indices into a (per-process) file 
descriptor table, thence a (system-wide) file table.

总结来说

A handle  is an abstract reference to a resource. Handle是对某个资源的抽象引用。
A handler is an asynchronous callback subroutine. Handler则是一个异步的回调函数(子程序)。

标签:resource,often,理解,handler,file,routine,handle
来源: https://blog.csdn.net/zn2857/article/details/116780443