diff --git a/include/pollcat/struct.h b/include/pollcat/struct.h index 38e044e..f820b35 100644 --- a/include/pollcat/struct.h +++ b/include/pollcat/struct.h @@ -95,7 +95,13 @@ struct pollcat *pollcat_iter_next (void); 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); diff --git a/src/struct.c b/src/struct.c index 0008e11..1f6d737 100644 --- a/src/struct.c +++ b/src/struct.c @@ -132,7 +132,10 @@ int pollcat_loop (int *poll_ret) /* check whether pollcat_loop_exit() has been called, and return 0 if so */ if ( pollcat_loop_stop ) + { + pollcat_loop_stop = 0; return 0; + } /* call pollcat_timer_reduce_timeout() to improve timer latency */ pollcat_timer_reduce_timeout();