Skip to content

Commit

Permalink
unix/mpconfigport: Allow overriding MICROPY_EVENT_POLL_HOOK.
Browse files Browse the repository at this point in the history
This allows variants to supply their own `MICROPY_EVENT_POLL_HOOK`.

Signed-off-by: David Lechner <david@pybricks.com>
  • Loading branch information
dlech authored and dpgeorge committed Jul 19, 2022
1 parent c947c25 commit 03fb671
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ports/unix/mpconfigport.h
Expand Up @@ -324,12 +324,14 @@ static inline unsigned long mp_urandom_seed_init(void) {
#define MICROPY_END_ATOMIC_SECTION(x) (void)x; mp_thread_unix_end_atomic_section()
#endif

#ifndef MICROPY_EVENT_POLL_HOOK
#define MICROPY_EVENT_POLL_HOOK \
do { \
extern void mp_handle_pending(bool); \
mp_handle_pending(true); \
usleep(500); /* equivalent to mp_hal_delay_us(500) */ \
} while (0);
#endif

#include <sched.h>
#define MICROPY_UNIX_MACHINE_IDLE sched_yield();
Expand Down

0 comments on commit 03fb671

Please sign in to comment.