i have add function f3 inside registerHandler function
app().registerHandler(
"/",
[](const HttpRequestPtr &,
std::function<void(const HttpResponsePtr &)> &&callback) {
auto resp = HttpResponse::newHttpResponse();
resp->setBody("Hello, World!");
callback(resp);
f3();
},
{Get});
this function is only test , that take time execution :
void f3() { for( long i = 1; i <= 100000000; ++i ) { std::cout<<"test"<<'\n'; } }
when i run ./helloword program work for first time in Browser
but when i want new tabs im Browser, no response from Server, while he take time for response!!!!
one solution call new Thread passing function f3,
i search other alternative solution !!!
i have add function f3 inside registerHandler function app().registerHandler( "/", [](const HttpRequestPtr &, std::function<void(const HttpResponsePtr &)> &&callback) { auto resp = HttpResponse::newHttpResponse(); resp->setBody("Hello, World!"); callback(resp); f3(); }, {Get}); this function is only test , that take time execution : void f3() { for( long i = 1; i <= 100000000; ++i ) { std::cout<<"test"<<'\n'; } }
when i run ./helloword program work for first time in Browser but when i want new tabs im Browser, no response from Server, while he take time for response!!!! one solution call new Thread passing function f3, i search other alternative solution !!!