简体   繁体   中英

signal handler vs event handler

Recently in an interview they asked me to point out the difference between signal handlers and event handlers. I have never encountered event handlers in Linux but after searching with Google I find event handlers are present in Windows.

I just want some more information regarding this question. Any information is most welcome.

I found that user have to write event handler function in order to capture events while default signal handlers are provided by kernel for the program.

Event handlers take care of the events external to the program like keyboard interrupt, mouse click etc. Event handlers would be polling continuously on a particular slot for the event to happen. So here it might consume the CPU life cycles.

Signal handlers also used for interprocess communication between two process. User can define their own signal handler for the process to handle particular signals. In signal handling mechanism I don't think any CPU cycles are consumed unnecessarily.

Please correct me if a not heading in the correct way.

我认为特定于事件的信号处理程序起源于内核,而事件处理程序是信号处理程序的一种更抽象的版本,并且包括“任何”类型的事件(单击事件,网络事件,信号等)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM