5 Commits

Author SHA1 Message Date
Adrian Chadd
87ba044ea4 [libami] handle EINTR from select() as a non-error
EINTR is happening during suspend/resume, which was causing all of
the modules to die (and requiring a restart of amiwm to re-run all
of its modules.)

This fixes things in FreeBSD suspend/resume so, well, the modules
keep working. :)
2023-06-12 11:39:41 -07:00
Adrian Chadd
4bd5a665db [libami] Add a 5 second read timeout so the periodic routine can be called
* add a basic select() loop for the read FD to see if it's ready
* optionally block in md_read() even if we timeout - this is used for
  the md_command() side of things
* md_handle_input() however doesn't block and will happily timeout
  so the loop can run and the periodic function can run.

This indeed seems to work.  It's a bit dirty, but it at least stops
the main loop from being fully blocking and that's super useful for
modules that wish to schedule background work.
2022-05-14 22:07:36 -07:00
Adrian Chadd
54adc01be4 [libami] document how the module loop works; start thinking about how to make it async
* Yeah it'd be nice to just use libevent here, alas
* Figure out how all the reading/writing works and comment it
* Add a periodic function that'll be called every trip through
  the main loop; will turn it into something more formally periodic
  later.

There's still lots to do here before I can actually schedule
periodic events and the read()s are non-blocking.  Give it time!
2022-05-08 14:04:21 -07:00
Adrian Chadd
31b2a069ea [libami] Fix compile warnings in module.c 2020-11-10 11:54:56 -08:00
reddsik
c85716f60e Initial commit! 2017-03-26 13:00:19 +02:00