Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4a5dbea

Browse filesBrowse files
Junliang Yanrvagg
authored andcommitted
test: fix missing unistd.h on windows
PR-URL: #3532 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 74e2328 commit 4a5dbea
Copy full SHA for 4a5dbea

File tree

Expand file treeCollapse file tree

1 file changed

+13
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-2
lines changed
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: test/addons/async-hello-world/binding.cc
+13-2Lines changed: 13 additions & 2 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.