I looked at the example and it shows two threads sharing a port and a single callback. I can see how this can emulate the old way of doing things but I have a question. There is only one MG_POLL_SERVE. If one of the threads blocks, how does it effect the other thread?
For expediency, if I need to stay with the old way, I still should update the version to the newest stable release before the change. Can you recommend the version and where to get an official copy. And while looking, the license change also is interesting (but does not effect my next project) If I understand it the old way necessitated a more open license. It needed to be built in more than used as a dll ???? The new way permits the dual license option better. On Fri, May 16, 2014 at 4:37 PM, Sergey Lyubka <[email protected]> wrote: > > > > 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. -- 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.
