libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] running in main thread


From: José Bollo
Subject: Re: [libmicrohttpd] running in main thread
Date: Mon, 2 Dec 2019 21:55:39 +0100

On Mon, 2 Dec 2019 17:41:09 +0100
Christian Grothoff <address@hidden> wrote:

> On 12/2/19 4:49 PM, José Bollo wrote:
> > On Mon, 2 Dec 2019 15:08:39 +0100
> > José Bollo <address@hidden> wrote:
> >   
> >> On Mon, 2 Dec 2019 15:04:52 +0100
> >> José Bollo <address@hidden> wrote:
> >>
> >> rereading comment of MHD_USE_INTERNAL_POLLING_THREAD my question
> >> looks stupid  
> > 
> > No in fact the question is serious. There is no simple way to let
> > run MHD on the main thread. It requires implementing an external
> > poll/select loop.
> > 
> > Can you provide an integrated main that serves and doesn't return
> > until stopped?  
> 
> That doesn't make sense to me, as then we don't have a 'stop'
> condition. With the internal polling thread, you can simply implement
> a while (! stop); yourself, and if you never want to stop, "while(1)
> sleep(1);" would do.
> 
> But usually you then _must_ do something else until you encounter your
> stop condition, and so that is what you should implement. Or you have
> an existing event loop, in which case you should use MHD's external
> event loop.
> 

I tried to write something like "while(true) MHD_run();" but strace
showed its inefficiency.

IMHO it can make sense: "1. setup 2. run" without exit conditon and not
bound to any stdin, i.e. a normal unix daemon.




reply via email to

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