Skip to content

Commit 99ed0f2

Browse files
committed
unix/mphalport.h: Add warning of mp_hal_delay_ms() implementation.
It's implemented in terms of usleep(), and POSIX doesn't guarantee that usleep() can sleep for more than a second. This restriction unlikely applies to any real-world system, but...
1 parent 6ed5583 commit 99ed0f2

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

unix/mphalport.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ void mp_hal_set_interrupt_char(char c);
3434
void mp_hal_stdio_mode_raw(void);
3535
void mp_hal_stdio_mode_orig(void);
3636

37+
// TODO: POSIX et al. define usleep() as guaranteedly capable only of 1s sleep:
38+
// "The useconds argument shall be less than one million."
3739
static inline void mp_hal_delay_ms(mp_uint_t ms) { usleep((ms) * 1000); }
3840
static inline void mp_hal_delay_us(mp_uint_t us) { usleep(us); }
3941

0 commit comments

Comments
 (0)