File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,11 @@ uint32_t get_scheduled_recurrent_delay_us()
149149 return (remaining > 0 ) ? static_cast <uint32_t >(remaining) : 0 ;
150150}
151151
152+ uint32_t get_scheduled_delay_us ()
153+ {
154+ return sFirst ? 0 : ~static_cast <decltype (micros ())>(0 ) >> 1 ;
155+ }
156+
152157void run_scheduled_functions ()
153158{
154159 // prevent scheduling of new functions during this run
Original file line number Diff line number Diff line change @@ -60,6 +60,13 @@ uint32_t get_scheduled_recurrent_delay_us();
6060// * Run the lambda only once next time.
6161// * A scheduled function can schedule a function.
6262
63+ // get_scheduled_delay_us() is named for symmetry to get_scheduled_recurrent_delay_us,
64+ // despite the lack of specific delay times. Therefore it can return only one of two
65+ // values, viz. 0 in case of any pending scheduled functions, or a large delay time if
66+ // there is no function in the queue.
67+
68+ uint32_t get_scheduled_delay_us ();
69+
6370bool schedule_function (const std::function<void (void )>& fn);
6471
6572// Run all scheduled functions.
You can’t perform that action at this time.
0 commit comments