Relation between ub_fd/ub_poll/ub_process and ub_ctx_async

Hello,

I'm not quite clear on the relation between ub_ctx_async() on the one
hand, and ub_fd(), ub_poll() and ub_process() the other hand. The
latter triple can clearly be integrated with an event loop, but the
former seems to suggest that background threads or processes are used.

If I use ub_resolve_async() but don't call ub_ctx_async() at all, will
there be no background thread or process and can I instead do my own
integration with an event loop? Otherwise, how does integration with an
event loop work?

-Rick

Hi Rick,

Hello,

I'm not quite clear on the relation between ub_ctx_async() on the one
hand, and ub_fd(), ub_poll() and ub_process() the other hand. The
latter triple can clearly be integrated with an event loop, but the
former seems to suggest that background threads or processes are used.

These calls all make a thread or process that does the work. And then
the result is piped back to you.

If I use ub_resolve_async() but don't call ub_ctx_async() at all, will
there be no background thread or process and can I instead do my own
integration with an event loop? Otherwise, how does integration with an
event loop work?

Look into unbound-event.h, where ub_resolve_event() is there so you can
integrate the resolution process in to your event loop.

Best regards, Wouter