8000 main: add re_nfds() and poll_method_get() getters by sreimers · Pull Request #435 · baresip/re · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

main: add re_nfds() and poll_method_get() getters #435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/re_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ void libre_close(void);
int re_main(re_signal_h *signalh);
void re_cancel(void);
int re_debug(struct re_printf *pf, void *unused);
int re_nfds(void);

int re_alloc(struct re **rep);
int re_thread_attach(struct re *re);
Expand All @@ -70,6 +71,7 @@ enum poll_method {
};

int poll_method_set(enum poll_method method);
enum poll_method poll_method_get(void);
enum poll_method poll_method_best(void);
const char *poll_method_name(enum poll_method method);
int poll_method_type(enum poll_method *method, const struct pl *name);
26 changes: 26 additions & 0 deletions src/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,32 @@ int re_debug(struct re_printf *pf, void *unused)
}


/**
* Get number of active file descriptors
*
* @return nfds
*/
int re_nfds(void)
{
struct re *re = re_get();

return re ? re->nfds : 0;
}


/**
* Get current async I/O polling method.
*
* @return enum poll_method
*/
enum poll_method poll_method_get(void)
{
struct re *re = re_get();

return re ? re->method : METHOD_NULL;
}


/**
* Set async I/O polling method. This function can also be called while the
* program is running.
Expand Down
0