aboutsummaryrefslogtreecommitdiff
path: root/fdm.c (follow)
Commit message (Collapse)AuthorAgeLines
* fdm: fix log messageDaniel Eklöf2020-01-10-1/+1
|
* fdm: verify FDs are non-blocking (debug builds only)Daniel Eklöf2020-01-10-0/+10
|
* fdm: add hook prioritiesDaniel Eklöf2020-01-04-13/+55
| | | | | | | | | | There are now three hook priorities: low, normal, high. High priority hooks are executed *first*. Normal next, and last the low priority hooks. The renderer's terminal refresh hook now runs as a normal priority hook.
* fdm: add support for hooksDaniel Eklöf2020-01-04-0/+49
| | | | | Hooks are functions executed just before going into a poll(). Or just after executing all FD handlers, if you like.
* fdm: close fd even if we didn't find it in our listDaniel Eklöf2019-12-15-0/+1
| | | | | | This behavior is debatable, but helps in error handling where we're removing a bunch of descriptors where not all of them have been added to the FDM yet.
* tllist: is now an external "library", so use <> includesDaniel Eklöf2019-11-17-1/+2
|
* fdm: invert check to get rid of one level of indentationDaniel Eklöf2019-11-02-13/+14
|
* fdm: add fdm_event_add() and fdm_event_del()Daniel Eklöf2019-11-02-1/+52
| | | | | These functions allow users to modify already registered FDs, to add or remove events they are interested in.
* fdm: bug: 'ret' was renamed to 'r', and replaced with another 'ret'Daniel Eklöf2019-11-02-1/+1
|
* fdm: rename struct fd -> struct handlerDaniel Eklöf2019-11-02-11/+11
|
* fdm: fdm_destroy(): assert deferred delete list is emptyDaniel Eklöf2019-11-02-0/+2
|
* fdm: purge deferred delete list also when handler failsDaniel Eklöf2019-11-02-5/+8
|
* fdm: fdm_poll(): disallow nested callsDaniel Eklöf2019-11-02-0/+6
|
* fdm: don't free FD data that may be referenced by epoll return dataDaniel Eklöf2019-11-01-9/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is perfectly possible, and legal, for a FDM handler to delete another handler. The problem however is when the epoll returned array of FD events contain the removed FD handler *after* the handler that removed it. That is, if the epoll returned array is: [FD=13, FD=37] and the handler for FD=13 removes FD=37, then given the current implementation, the FD user data (our handler callback etc) will point to a free:d address. Add support for this situation by deferring FD handler removal *when called from another handler*. This is done by "locking" the FDM struct before looping the handlers for FDs with events (and unlocking afterwards). In fdm_del(), we check if the FDM has been locked, in which case the FD is marked as deleted, and put on a deferred list. But not *actually* deleted. Meanwhile, in the FDM poll function, we skip calling handlers for marked-for-deletion FDs. Then, when all FDs have been processed, we loop the deferred list and finally deletes the FDs for real.
* fdm: use the FDM's poll loopDaniel Eklöf2019-10-27-0/+124