File tree 2 files changed +12
-0
lines changed
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()
149
149
return (remaining > 0 ) ? static_cast <uint32_t >(remaining) : 0 ;
150
150
}
151
151
152
+ uint32_t get_scheduled_delay_us ()
153
+ {
154
+ return sFirst ? 0 : ~static_cast <decltype (micros ())>(0 ) >> 1 ;
155
+ }
156
+
152
157
void run_scheduled_functions ()
153
158
{
154
159
// 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();
60
60
// * Run the lambda only once next time.
61
61
// * A scheduled function can schedule a function.
62
62
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
+
63
70
bool schedule_function (const std::function<void (void )>& fn);
64
71
65
72
// Run all scheduled functions.
You can’t perform that action at this time.
0 commit comments