[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] Sharing per-thread resources between connections
From: |
Christian Grothoff |
Subject: |
Re: [libmicrohttpd] Sharing per-thread resources between connections |
Date: |
Tue, 12 Aug 2014 23:20:21 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.7.0 |
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.