|
From: | Carlos Eduardo Moreira dos Santos |
Subject: | Re: [libmicrohttpd] Sharing per-thread resources between connections |
Date: | Tue, 19 Aug 2014 01:45:15 -0300 |
The real answer is that _you_ must measure it --- especially since the
real answer will depend on your platform, application and performance
requirements. I _suspect_ that it won't matter either way.
Happy hacking!
-Christian
On 08/12/2014 10:36 PM, Carlos Eduardo Moreira dos Santos wrote:
> __thread keyword is simple to use, but I have to open one socket per
> thread, so I used pthread_once and also pthread_key_create to close it. The
> only disadvantage I noticed is running pthread_once in every access handler
> callback call. I don't know the details, but pthread_once should be fast
> enough to discard my code, isn't it?
>
> Best,
> Carlos Eduardo
>
>
> On Thu, Jul 3, 2014 at 5:05 AM, Christian Grothoff <address@hidden>
> wrote:
>
>> Well, pthread_key_create() also works, I guess, but I was thinking about
>> a slightly more lightweight method:
>>
>> http://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/Thread-Local.html
>>
>> But both should work, and the best choice may really depend on your
>> application and its intended environment.
[Prev in Thread] | Current Thread | [Next in Thread] |