summaryrefslogtreecommitdiffstatshomepage
path: root/ports/unix/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'ports/unix/main.c')
-rw-r--r--ports/unix/main.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/ports/unix/main.c b/ports/unix/main.c
index 8d7fcf4843..0e00db7fa2 100644
--- a/ports/unix/main.c
+++ b/ports/unix/main.c
@@ -328,6 +328,10 @@ STATIC void print_help(char **argv) {
, heap_size);
impl_opts_cnt++;
#endif
+ #if defined(__APPLE__)
+ printf(" realtime -- set thread priority to realtime\n");
+ impl_opts_cnt++;
+ #endif
if (impl_opts_cnt == 0) {
printf(" (none)\n");
@@ -399,6 +403,15 @@ STATIC void pre_process_options(int argc, char **argv) {
goto invalid_arg;
}
#endif
+ #if defined(__APPLE__)
+ } else if (strcmp(argv[a + 1], "realtime") == 0) {
+ #if MICROPY_PY_THREAD
+ mp_thread_is_realtime_enabled = true;
+ #endif
+ // main thread was already intialized before the option
+ // was parsed, so we have to enable realtime here.
+ mp_thread_set_realtime();
+ #endif
} else {
invalid_arg:
exit(invalid_args());