mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-02-21 17:56:47 +00:00
Add time constants representing +/- infinity, don't schedule an alarm that will never run
This commit is contained in:
parent
3b14543750
commit
68b8f94b01
@ -103,6 +103,10 @@ int _schedule(struct __sourceloc __whence, struct sched_ent *alarm)
|
||||
if (!alarm->function)
|
||||
return WHY("Can't schedule if you haven't set the function pointer");
|
||||
|
||||
// don't bother to schedule an alarm that will (by definition) never run
|
||||
if (alarm->alarm == TIME_NEVER_WILL)
|
||||
return 0;
|
||||
|
||||
if (alarm->deadline < alarm->alarm)
|
||||
alarm->deadline = alarm->alarm;
|
||||
|
||||
|
2
os.h
2
os.h
@ -55,6 +55,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
typedef int64_t time_ms_t;
|
||||
#define PRItime_ms_t PRId64
|
||||
#define TIME_NEVER_WILL INT64_MAX
|
||||
#define TIME_NEVER_HAS INT64_MIN
|
||||
|
||||
time_ms_t gettime_ms();
|
||||
time_ms_t sleep_ms(time_ms_t milliseconds);
|
||||
|
Loading…
x
Reference in New Issue
Block a user