Subject: Re: [PATCH 2/3] library init: documentation update

Re: [PATCH 2/3] library init: documentation update

From: Alexander Klauer <Alexander.Klauer_at_itwm.fraunhofer.de>
Date: Wed, 10 Apr 2013 11:14:30 +0200

On 04/10/2013 11:07 AM, Alexander Klauer wrote:
> Hi,
>
> no need to CC me, I'm subscribed.
>
> On 04/10/2013 10:44 AM, Saúl Ibarra Corretgé wrote:
>> On 4/10/13 10:03 AM, Alexander Klauer wrote:
>>> On 03/18/2013 09:26 AM, Alexander Klauer wrote:
>>>> On 03/15/2013 08:26 PM, Yang Tse wrote:
>>>>> On Fri, Mar 15, 2013, Alexander Klauer
>>>>> <Alexander.Klauer_at_itwm.fraunhofer.de> wrote:
>>>>>
>>>>>> This commit updates the documentation of ares_library_init() and
>>>>>> ares_library_cleanup() with regard to the new recursive behaviour.
>>>>>
>>>>> It might be better to use "Its reference counted
>>>>> initialize/deinitialize behavior," or something similar, instead of
>>>>> "Its recursive behavior,"
>>>>>
>>>>
>>>> OK, I've updated the commit.
>>>
>>> Any further comments? If not, could this patchset be committed, please?
>>> TIA.
>>>
>>
>> I'm no expert, but I thought I'd throw my 2 cents here :-) What about
>> using something like pthread_once? Would that work for you? Not sure if
>> that's supported in all platforms though.
>
> That would work on systems where it's supported, but unfortunately, it's
> not portable. Since one of the points of having an asynchronous resolver
> is not having to deal with threads in the first place, I'd be loath to
> import a dependency on a threading library into c-ares.

I just forgot: pthread_once() would work for the library init, but the
finalisation has to be taken care of as well, so you need some kind of
reference counting.

Best regards,
Alexander
Received on 2013-04-10