Skip to content

Commit 4a5dbea

Browse files
Junliang Yanrvagg
Junliang Yan
authored andcommitted
test: fix missing unistd.h on windows
PR-URL: #3532 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 74e2328 commit 4a5dbea

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

test/addons/async-hello-world/binding.cc

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
#include <unistd.h>
21
#include <node.h>
32
#include <v8.h>
43
#include <uv.h>
54

5+
#if defined _WIN32
6+
#include <windows.h>
7+
#else
8+
#include <unistd.h>
9+
#endif
10+
11+
612
struct async_req {
713
uv_work_t req;
814
int input;
@@ -13,7 +19,12 @@ struct async_req {
1319

1420
void DoAsync(uv_work_t* r) {
1521
async_req* req = reinterpret_cast<async_req*>(r->data);
16-
sleep(1); // Simulate CPU intensive process...
22+
// Simulate CPU intensive process...
23+
#if defined _WIN32
24+
Sleep(1000);
25+
#else
26+
sleep(1);
27+
#endif
1728
req->output = req->input * 2;
1829
}
1930

0 commit comments

Comments
 (0)