get current (pluggable) eventloop from context

So applications can schedule events against it...
This commit is contained in:
Willem Toorop 2016-06-17 16:50:47 +02:00
parent 22095f23f6
commit 2873645068
2 changed files with 19 additions and 0 deletions

View File

@ -3266,6 +3266,20 @@ getdns_context_set_eventloop(getdns_context* context, getdns_eventloop* loop)
return GETDNS_RETURN_GOOD;
}
getdns_return_t
getdns_context_get_eventloop(getdns_context *context, getdns_eventloop **loop)
{
if (!context || !loop)
return GETDNS_RETURN_INVALID_PARAMETER;
if (!context->extension)
return GETDNS_RETURN_GENERIC_ERROR;
else
*loop = context->extension;
return GETDNS_RETURN_GOOD;
}
static in_port_t
upstream_port(getdns_upstream *upstream)
{

View File

@ -119,6 +119,11 @@ getdns_return_t
getdns_context_set_eventloop(getdns_context* context,
getdns_eventloop *eventloop);
/* get the currently active (pluggable) eventloop from the context */
getdns_return_t
getdns_context_get_eventloop(getdns_context* context,
getdns_eventloop **eventloop);
/* detach the eventloop from the context */
getdns_return_t
getdns_context_detach_eventloop(getdns_context *context);