Skip to content

Commit 6f2a0b8

Browse files
authored
Merge pull request #157 from deanmsands3/master
Adapted sleep function in 'examples/deferred_with_accumulator.cpp' for non-*Nix
2 parents 3ffda7b + 375a974 commit 6f2a0b8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/deferred_with_accumulator.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
USA
1919
*/
2020

21+
#include <chrono>
22+
#include <thread>
2123
#include <atomic>
2224
#include <httpserver.hpp>
2325

@@ -44,7 +46,8 @@ ssize_t test_callback (std::shared_ptr<std::atomic<int> > closure_data, char* bu
4446
std::copy(str.begin(), str.end(), buf);
4547

4648
// keep sending reqid
47-
sleep(1);
49+
// sleep(1); ==> adapted for C++11 on non-*Nix systems
50+
std::this_thread::sleep_for(std::chrono::seconds(1));
4851

4952
return (ssize_t)max;
5053
}

0 commit comments

Comments
 (0)