2 ms·
Similar to the meaning in electronics: edge-triggered reports on changes of state, level-triggered on state. When you use epoll in edge-triggered mode it retur
by detaro 10y ago
Similar to the meaning in electronics: edge-triggered reports on changes of state, level-triggered on state.
When you use epoll in edge-triggered mode it returns and reports a resource as available once, when it was unavailable and just switched to being available. If you enter epoll again, it won't return just to report the resource is available.
In level-triggered mode, when a resource polled on is available it always returns immediately to report it as available.
Edge-triggered is useful to make sure you only act once on a resource becoming available (e.g. by handing it to a worker thread that will work in the background, you want to enter epoll in the main thread again to wait for other changes) or if you have to wait for something else to become available to actually be able to do something with it and don't want to waste time spinning in the waiting state (e.g. when moving data between two sockets, both have to be available, so you only want to wake up when the second one changes as well).