libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] running in main thread


From: silvioprog
Subject: Re: [libmicrohttpd] running in main thread
Date: Mon, 2 Dec 2019 16:33:59 -0300

On Mon, Dec 2, 2019 at 2:22 PM silvioprog <address@hidden> 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

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