Skip to content

Commit

Permalink
main: add re_thread_enter/leave polling check
Browse files Browse the repository at this point in the history
re_lock()/re_unlock() is only needed if re_main() is running.
  • Loading branch information
sreimers committed May 3, 2023
1 parent 2516169 commit 09c4358
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,9 @@ void re_thread_enter(void)
return;
}

if (!re_atomic_rlx(&re->polling))
return;

re_lock(re);

/* set only for non-re threads */
Expand All @@ -1235,6 +1238,10 @@ void re_thread_leave(void)
DEBUG_WARNING("re_thread_leave: re not ready\n");
return;
}

if (!re_atomic_rlx(&re->polling))
return;

/* Dummy async event, to ensure timers are properly handled */
if (re->async)
re_thread_async(NULL, NULL, NULL);
Expand Down

0 comments on commit 09c4358

Please sign in to comment.