On Sat, May 10, 2014 at 2:58 PM, Anwar Ludin <[email protected]> wrote:
> Hi, > > I' m new to libmongoose, so sorry if this question has been asked in the > past. I want to use libmongoose to build a rest service. I had a cursory > look at the APIs and came with the following questions: > > - From my understanding, you need to define a callback function in order > to handle a network connection. My question is does this callback function > runs in a different thread for each connection than the main "server > polling" thread? In other words, can I safely assume that the main server > thread will not be blocked if my callback function takes a long time to > process the request? > Callback function runs in a main polling thread. To put it simply, mg_poll_server() calls it. Callback must not block, otherwise it'll stall all other connections. - If the answer to the previous question is yes, I can I manage parameters > such as the thread pool used by libmongoose? > If you need scalability by multiple cores, start several server instances and share the listening socket, like in https://github.com/cesanta/mongoose/blob/master/examples/multi_threaded.c > > - In the API examples, there is a multithreading example, which basically > creates multiple servers to handle requests. Is there a typical use case > for such a scenario (I would rather prefer having a single server instance > with a thread pool). > See above. > > Thanks! > > Anwar > > -- > You received this message because you are subscribed to the Google Groups > "mongoose-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/mongoose-users. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "mongoose-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/mongoose-users. For more options, visit https://groups.google.com/d/optout.
