[getdns-api] PHP Language Bindings and Async Event Management
Hollenbeck, Scott
shollenbeck at verisign.com
Tue Apr 21 13:30:07 CEST 2015
> -----Original Message-----
> From: getdns-api [mailto:getdns-api-bounces at vpnc.org] On Behalf Of
> Goyal, Neel
> Sent: Monday, April 20, 2015 1:58 PM
> To: Melinda Shore; getdns-api at vpnc.org
> Subject: Re: [getdns-api] PHP Language Bindings and Async Event
> Management
>
> Freeing the context should not clean up the event base. If the event
> base
> is shared between other async libs and they are adding to that event
> base,
> a context destroy should not prevent those libs from still functioning.
> The context_destroy makes sure the context is detached from the
> event_base, but any structures specific to libevent are not cleaned up.
> Much like the user has to create the lib event base explicitly and then
> attach it to getdns, the user has to free it.
Neel, in a note I sent to this list last week (BTW, it looks like recent notes aren't being archived) I described a challenge I found in trying to use the PHP libevent extension with getdns. I can create an event base, but I don't see an easy way to attach that to a context. Come on down if you have a chance and I'll walk you through what I found.
So, I took a look at how I could use the functions provided by the getdns libevent extension. Looking at the code in context.c, I found that getdns_context_create() calls getdns_context_create_with_memory_functions(), which calls getdns_context_create_with_extended_memory_functions(). That function calls getdns_mini_event_init() (in file libmini_event.c), which creates an event base and sets an event loop. That base is cleaned up when calling getdns_context_destroy(), which calls context->extension->vmt->cleanup(context->extension).
Scott
_______________________________________________
getdns-api mailing list
getdns-api at vpnc.org
More information about the spec
mailing list