how to make the server non-blocking #2661
-
Hi, I am new to mongoose web server. I just imported the mongoose into my project and made it work. One thing I noticed is that the server works in a single thread and everything is driven by mg_mgr_poll in the the main loop context. If there is a HTTP request and the server cannot get the response ready quickly (in our case the server is just a local network gateway and it needs to collect the related information from other devices in the local network before it can compose the HTTP response), I suppose the service will be blocked, i.e., the server won't able to respond to other requests before the callback fn returns. Is my understanding on this right? If so, if there a way to avoid this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Please follow the guidelines in the documentation, examples and tutorials available. From the docs
If you absolutely need multi-threading, take the time to go through the user guide (linked above) and tutorials, there is one that shows you how to do multi-threading. |
Beta Was this translation helpful? Give feedback.
Please follow the guidelines in the documentation, examples and tutorials available.
From the docs
If you absolutely need multi-threading, take the time to go through the user guide (linked above) and tutorials, there is one that shows you how to do multi-threading.