Updated work example

This commit is contained in:
eidheim 2016-06-29 12:26:11 +02:00
commit 233fd31982
2 changed files with 2 additions and 4 deletions

View file

@ -89,11 +89,10 @@ int main() {
//Get example simulating heavy work in a separate thread
server.resource["^/work$"]["GET"]=[&server](shared_ptr<HttpsServer::Response> response, shared_ptr<HttpsServer::Request> /*request*/) {
*response << "HTTP/1.1 200 OK\r\n";
thread work_thread([response] {
this_thread::sleep_for(chrono::seconds(5));
string message="Work done";
*response << "Content-Length: " << message.length() << "\r\n\r\n" << message;
*response << "HTTP/1.1 200 OK\r\nContent-Length: " << message.length() << "\r\n\r\n" << message;
});
work_thread.detach();
};