[Pdns-dev] Question regarding life time of backend threads in PDNS
Peter van Dijk
peter.van.dijk at netherlabs.nl
Thu Nov 7 15:41:24 CET 2013
On Nov 7, 2013, at 6:19 , Seema Datar wrote:
> We have a use case where we use PDNS with 8 backend threads. We needed to save thread specific data in an mmap. However, I came across the following in PDNS documentation -
> PowerDNS may instantiate multiple instances of your backend, or destroy existing copies and instantiate new ones. Backend code should therefore be thread-safe with respect to its static data. Additionally, it is wise if instantiation is a fast operation, with the possible exception of the first construction.
> The questions I had are -
> • What is the lifetime of a backend thread?
Sometimes, only one query.
> • How often does a thread get destroyed and a new thread get created?
Some threads will live for a long time. Some other threads will come and go quickly.
> • Is there any interface available to do a cleanup before the thread ends?
Yes - the class destructor. Look at GeoBackend::~GeoBackend() or LUABackend::~LUABackend() for an example.
By the way, please keep these posts confined to the pdns-dev list.
Peter van Dijk
Netherlabs Computer Consulting BV - http://www.netherlabs.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
More information about the Pdns-dev