On Mon, Dec 2, 2019 at 2:22 PM silvioprog <silviop...@gmail.com> 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_YES : MHD_NO;
> }
>
> MHD_main_loop(my_awesome_callback, NULL);
>

Another (possible?) option (supposing a function named "MHD_poll"):

int main(void) {
  /* some MHD deamon initialization */
  while (!terminated) { /* terminated -> e.g.: some termination condition
handle by signal */
    MHD_poll(); // something similar too:
https://github.com/cesanta/mongoose/blob/master/examples/simplest_web_server/simplest_web_server.c#L33
  }
}

So the MHD_poll() would allow to reuse the built in MHD's select/epoll in
any external thread (for example, in the main thread of a console
application).

Maybe a MHD_poll() is already implemented in MHD in some private function.
If so, that function would be very appreciated as an external function. :-)

--
Silvio Clécio

Reply via email to