[libmicrohttpd] running in main thread

2019-12-02 Thread José Bollo
Hi all, I searched in examples how to "block" in main thread on serving files but I only found examples with the sequence summarized here: MHD_start_daemon ... getc ... MHD_stop_daemon For my use I'm searching to just run the server without having to wait for a key or anything except ctrl+C o

Re: [libmicrohttpd] running in main thread

2019-12-02 Thread José Bollo
On Mon, 2 Dec 2019 15:04:52 +0100 José Bollo wrote: rereading comment of MHD_USE_INTERNAL_POLLING_THREAD my question looks stupid sorry for the noise > Hi all, > > I searched in examples how to "block" in main thread on serving files > but I only found examples with the sequence summarized her

Re: [libmicrohttpd] running in main thread

2019-12-02 Thread José Bollo
On Mon, 2 Dec 2019 15:08:39 +0100 José Bollo wrote: > On Mon, 2 Dec 2019 15:04:52 +0100 > José Bollo 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 requi

Re: [libmicrohttpd] running in main thread

2019-12-02 Thread Christian Grothoff
On 12/2/19 4:49 PM, José Bollo wrote: > On Mon, 2 Dec 2019 15:08:39 +0100 > José Bollo wrote: > >> On Mon, 2 Dec 2019 15:04:52 +0100 >> José Bollo wrote: >> >> rereading comment of MHD_USE_INTERNAL_POLLING_THREAD my question looks >> stupid > > No in fact the question is serious. There is no si

Re: [libmicrohttpd] running in main thread

2019-12-02 Thread silvioprog
Dear friends. On Mon, Dec 2, 2019 at 12:49 PM José Bollo wrote: > 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 >

Re: [libmicrohttpd] running in main thread

2019-12-02 Thread silvioprog
On Mon, Dec 2, 2019 at 2:22 PM silvioprog wrote: > In Rust and Pascal we generally call some locking function to stay > "running" application, in those cases, it would be nice to call something > like this: > > static int my_awesome_callback(void *cls) { > return *application_terminated* ? MHD_

Re: [libmicrohttpd] running in main thread

2019-12-02 Thread José Bollo
On Mon, 2 Dec 2019 17:41:09 +0100 Christian Grothoff wrote: > On 12/2/19 4:49 PM, José Bollo wrote: > > On Mon, 2 Dec 2019 15:08:39 +0100 > > José Bollo wrote: > > > >> On Mon, 2 Dec 2019 15:04:52 +0100 > >> José Bollo wrote: > >> > >> rereading comment of MHD_USE_INTERNAL_POLLING_THREAD my

Re: [libmicrohttpd] running in main thread

2019-12-02 Thread Christian Grothoff
On 12/2/19 9:55 PM, José Bollo wrote: > > I tried to write something like "while(true) MHD_run();" but strace > showed its inefficiency. Oh my. Yes, that'd be bad. > IMHO it can make sense: "1. setup 2. run" without exit conditon and not > bound to any stdin, i.e. a normal unix daemon. > Well,

Re: [libmicrohttpd] running in main thread

2019-12-02 Thread José Bollo
On Mon, 2 Dec 2019 22:03:51 +0100 Christian Grothoff wrote: > On 12/2/19 9:55 PM, José Bollo wrote: > > > > I tried to write something like "while(true) MHD_run();" but strace > > showed its inefficiency. > > Oh my. Yes, that'd be bad. > > > IMHO it can make sense: "1. setup 2. run" without

Re: [libmicrohttpd] running in main thread

2019-12-02 Thread Christian Grothoff
On 12/2/19 10:18 PM, José Bollo wrote: >> Well, that's trivial. Please consider the attached fragment (not >> tested, but should be very close to what you need, modulo error >> handling). > I know it is trivial (my implementation below) but I advocate to offer > a facility that does the job. It avo