Skip to content

Commit

Permalink
main: add re_fhs_flush
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers committed Jan 20, 2025
1 parent 0646ade commit f88cc44
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/re_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ void re_thread_async_cancel(intptr_t id);
void re_thread_async_main_cancel(intptr_t id);

void re_set_mutex(void *mutexp);
void re_fhs_flush(void);

struct tmrl *re_tmrl_get(void);

Expand Down
20 changes: 20 additions & 0 deletions src/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1654,3 +1654,23 @@ void re_thread_async_main_cancel(intptr_t id)

re_async_cancel(re->async, id);
}


/**
* Flush file descriptors handlers if re loop is not running
*/
void re_fhs_flush(void)
{
struct re *re = re_get();
if (!re) {
DEBUG_WARNING("re_fhs_flush: re not ready\n");
return;
}

if (re_atomic_rlx(&re->polling)) {
DEBUG_WARNING("re_fhs_flush: re polling is running\n");
return;
}

fhsld_flush(re);
}

0 comments on commit f88cc44

Please sign in to comment.