Does he support multithreading?
jinwuZhu opened this issue · comments
If I have a very time-consuming operation in the HTTP Callback, will it block subsequent requests?
`
//Code ....
//SetUP
mg_connection* co = mg_http_listen(mgr, strHost.c_str(), mongoose_http_callback, this); // Setup listener
// Code ...
// function 'mongoose_http_callback'
void mongoose_http_callback(struct mg_connection* c, int ev, void* ev_data, void* fn_data) {
CHTTPServer* self = (CHTTPServer*)(fn_data);
sleep(3000); // If there are very time-consuming operations here
self->Do(c,ev,ev_data);
}
`
Please follow the guidelines in the documentation, examples and tutorials available.
From the docs
NOTE: Since Mongoose's core is not protected against concurrent accesses, make sure that all mg_* API functions are called from the same thread or RTOS task.
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.