How to create timer inside a thread

Hi, David,

The Legato Timer API is integrated with the Legato Event Loop. Your thread is not running the Legato Event Loop, so the timer expiry never gets handled.

You can fix this in either of two ways:

  • Instead of using your own loop, with poll(), use the Legato event loop by calling le_event_RunLoop() in your thread.
  • Use le_event_GetFd() to fetch an event loop file descriptor that will become “ready to read” (POLLIN) when there’s something that the Legato event loop needs to process, and then call le_event_ServiceLoop() when the event loop fd becomes ready to read.

Cheers,

–Jen