[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] libmicrohttpd, serialized access

From: Christian Grothoff
Subject: Re: [libmicrohttpd] libmicrohttpd, serialized access
Date: Sun, 29 Jun 2014 23:40:28 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.6.0


If you have to replace pthread_mutex_* anyway and are using
MHD_USE_SELECT_INTERNALLY, it is indeed safe to replace those
functions with NOP.

Happy hacking!


On 06/29/2014 11:12 PM, Martin Velek wrote:
> Hi,
> I am using FreeRTOS running on CortexM3. Every mutex takes valuable
> resources (SRAM and a record in the handle table). The NOP should be
> No operation, e.g. the create function returns valid value but not
> takes any resources, lock/unlock/delete does nothing. I have to
> replace the pthread_mutex_* anyway because the FreeRTOS does not
> support POSIX threads.
> I think the logic should not be broken but I do not know if there is
> code starting some thread requiring to lock the mutex even with
> MHD_USE_SELECT_INTERNALLY. I did not notice and find such behaviour so
> far. To convince myself I had to ask :).
> Regards
> Martin
> On Fri, Jun 27, 2014 at 11:44 AM, Christian Grothoff
> <address@hidden> wrote:
>> Hi!
>> If you're on Linux, this is almost the case, as with a single thread
>> you obviously cannot have lock contention, and you're using a Futex
>> ( -- so the cost is very close to
>> that of a NOP (no system call).  In fact, I would be surprised if
>> replacing the logic with the equivalent of "if (! (daemon->options &
>> MHD_USE_SELECT_INTERNALLY)) lock()" would give you any speed-up (it'd
>> still technically be a branch and not a real NOP).
>> Anyway, if you have a different reason for asking (other than
>> performance concerns) or have real data showing that there is a
>> difference, please explain more and I'll be happy to listen.
>> Happy hacking!
>> Christian
>> On 06/27/2014 11:18 AM, Martin Velek wrote:
>>> Hello,
>>> I am using libmicrohttpd with the MHD_USE_SELECT_INTERNALLY flag only
>>> (one thread). Every request is processed in the libmicrohttpd thread
>>> and neither MHD_Connection * nor MHD_Response * are processed outside
>>> the thread.
>>> Is it possible to make all pthread_mutex_* calls as no-ops?
>>> Martin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]