test: fix missing unistd.h on windows
PR-URL: https://github.com/nodejs/node/pull/3532 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
26e47efbca
commit
4139f2a820
@ -1,8 +1,14 @@
|
|||||||
#include <unistd.h>
|
|
||||||
#include <node.h>
|
#include <node.h>
|
||||||
#include <v8.h>
|
#include <v8.h>
|
||||||
#include <uv.h>
|
#include <uv.h>
|
||||||
|
|
||||||
|
#if defined _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
struct async_req {
|
struct async_req {
|
||||||
uv_work_t req;
|
uv_work_t req;
|
||||||
int input;
|
int input;
|
||||||
@ -13,7 +19,12 @@ struct async_req {
|
|||||||
|
|
||||||
void DoAsync(uv_work_t* r) {
|
void DoAsync(uv_work_t* r) {
|
||||||
async_req* req = reinterpret_cast<async_req*>(r->data);
|
async_req* req = reinterpret_cast<async_req*>(r->data);
|
||||||
sleep(1); // Simulate CPU intensive process...
|
// Simulate CPU intensive process...
|
||||||
|
#if defined _WIN32
|
||||||
|
Sleep(1000);
|
||||||
|
#else
|
||||||
|
sleep(1);
|
||||||
|
#endif
|
||||||
req->output = req->input * 2;
|
req->output = req->input * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user