<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/fdm.c, branch 1.0.0</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.0.0</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.0.0'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2019-11-17T18:19:55Z</updated>
<entry>
<title>tllist: is now an external "library", so use &lt;&gt; includes</title>
<updated>2019-11-17T18:19:55Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-11-17T18:19:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=29cccadd1d9c372b3861bb0c285628bb374da2ba'/>
<id>urn:sha1:29cccadd1d9c372b3861bb0c285628bb374da2ba</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fdm: invert check to get rid of one level of indentation</title>
<updated>2019-11-02T23:52:24Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-11-02T23:42:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=777d851282a59fcfacc19b9232b9ad80c412efdf'/>
<id>urn:sha1:777d851282a59fcfacc19b9232b9ad80c412efdf</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fdm: add fdm_event_add() and fdm_event_del()</title>
<updated>2019-11-02T23:52:24Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-11-02T23:22:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=89997b97a0fb7f0fe0fa06de5409a03ed9ee91a8'/>
<id>urn:sha1:89997b97a0fb7f0fe0fa06de5409a03ed9ee91a8</id>
<content type='text'>
These functions allow users to modify already registered FDs, to add
or remove events they are interested in.
</content>
</entry>
<entry>
<title>fdm: bug: 'ret' was renamed to 'r', and replaced with another 'ret'</title>
<updated>2019-11-02T23:51:47Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-11-02T23:51:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e09bda322a2d39e6692b3dbd3ccf72bc86951737'/>
<id>urn:sha1:e09bda322a2d39e6692b3dbd3ccf72bc86951737</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fdm: rename struct fd -&gt; struct handler</title>
<updated>2019-11-02T22:37:19Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-11-02T22:37:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=8ffa021de86b08b28be33b769f129c3c951ad1a7'/>
<id>urn:sha1:8ffa021de86b08b28be33b769f129c3c951ad1a7</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fdm: fdm_destroy(): assert deferred delete list is empty</title>
<updated>2019-11-02T22:36:02Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-11-02T22:36:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9b67a6627ad42557dd71e9bd09a21bd75f0d3b45'/>
<id>urn:sha1:9b67a6627ad42557dd71e9bd09a21bd75f0d3b45</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fdm: purge deferred delete list also when handler fails</title>
<updated>2019-11-02T22:35:42Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-11-02T22:35:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ba7f79af18ef3713eefc71a52012e255adfbc30e'/>
<id>urn:sha1:ba7f79af18ef3713eefc71a52012e255adfbc30e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fdm: fdm_poll(): disallow nested calls</title>
<updated>2019-11-02T12:46:54Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-11-02T12:46:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=c99c0285dc5d5fc38fa4dbee1cba70a660578fca'/>
<id>urn:sha1:c99c0285dc5d5fc38fa4dbee1cba70a660578fca</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fdm: don't free FD data that may be referenced by epoll return data</title>
<updated>2019-11-01T18:51:33Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-11-01T18:51:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=80c4721e578ae20f6c5a6b7959fde909582eeb85'/>
<id>urn:sha1:80c4721e578ae20f6c5a6b7959fde909582eeb85</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>fdm: use the FDM's poll loop</title>
<updated>2019-10-27T10:46:18Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-10-27T10:46:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5fefb950b3a1de2c8c8e2cbfecf4ed3790ecffef'/>
<id>urn:sha1:5fefb950b3a1de2c8c8e2cbfecf4ed3790ecffef</id>
<content type='text'>
</content>
</entry>
</feed>
