Make pollcat_loop_exit() a oneshot

This commit is contained in:
2022-07-09 10:55:55 -07:00
parent bbd4625d43
commit ced09400f9
2 changed files with 10 additions and 1 deletions

View File

@@ -95,7 +95,13 @@ struct pollcat *pollcat_iter_next (void);
int pollcat_loop (int *poll_ret); int pollcat_loop (int *poll_ret);
/** Cause pollcat_loop() to return 0 on its next call /** Cause pollcat_loop() to return 0 on its next call only
*
* \note Each call of pollcat_loop_exit() causes pollcat_loop() to return 0 once;
* pollcat_loop() then resets the flag to return nonzero until the next time
* pollcat_loop_exit() has been called. This allows the entire main loop to be
* wrapped in an outer loop so tasks like updating firmware can be done without
* affecting the pollcat loop.
*/ */
void pollcat_loop_exit (void); void pollcat_loop_exit (void);

View File

@@ -132,7 +132,10 @@ int pollcat_loop (int *poll_ret)
/* check whether pollcat_loop_exit() has been called, and return 0 if so */ /* check whether pollcat_loop_exit() has been called, and return 0 if so */
if ( pollcat_loop_stop ) if ( pollcat_loop_stop )
{
pollcat_loop_stop = 0;
return 0; return 0;
}
/* call pollcat_timer_reduce_timeout() to improve timer latency */ /* call pollcat_timer_reduce_timeout() to improve timer latency */
pollcat_timer_reduce_timeout(); pollcat_timer_reduce_timeout();