Skip to content

Commit bce41fa

Browse files
Igor Zinkovskyry
Igor Zinkovsky
authored andcommitted
Use new uv_fs_ apis
This will cause master to be unstable for a while as we replace existing eio calls with uv_fs calls.
1 parent 1088638 commit bce41fa

10 files changed

+128
-849
lines changed

deps/pthread-win32/COPYING.LIB

-504
This file was deleted.

deps/pthread-win32/libpthreadGC2.a

-62.6 KB
Binary file not shown.

deps/pthread-win32/libpthreadGC2d.a

-107 KB
Binary file not shown.

node.gyp

-9
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,9 @@
7272
'src/req_wrap.h',
7373
'src/stream_wrap.h',
7474
'src/v8_typed_array.h',
75-
'deps/uv/src/eio/ecb.h',
76-
'deps/uv/include/eio.h',
7775
'deps/http_parser/http_parser.h',
7876
'deps/v8/include/v8.h',
7977
'deps/v8/include/v8-debug.h',
80-
'deps/uv/src/eio/xthread.h',
8178
'<(SHARED_INTERMEDIATE_DIR)/node_natives.h',
8279
],
8380

@@ -104,19 +101,13 @@
104101
}],
105102

106103
[ 'OS=="win"', {
107-
'dependencies': [
108-
'deps/uv/deps/pthread-win32/pthread-win32.gyp:pthread-win32',
109-
],
110104
'sources': [
111105
'src/platform_win32.cc',
112106
'src/node_stdio_win32.cc',
113-
# file operations depend on eio to link. uv contains eio in unix builds, but not win32. So we need to compile it here instead.
114-
'deps/uv/src/eio/eio.c',
115107
# headers to make for a more pleasant IDE experience
116108
'src/platform_win32.h',
117109
],
118110
'defines': [
119-
'PTW32_STATIC_LIB',
120111
'FD_SETSIZE=1024',
121112
# we need to use node's preferred "win32" rather than gyp's preferred "win"
122113
'PLATFORM="win32"',

src/node.cc

-77
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,6 @@ static uv_idle_t tick_spinner;
141141
static bool need_tick_cb;
142142
static Persistent<String> tick_callback_sym;
143143

144-
static uv_async_t eio_want_poll_notifier;
145-
static uv_async_t eio_done_poll_notifier;
146-
static uv_idle_t eio_poller;
147-
148144

149145
static bool use_uv = true;
150146

@@ -306,62 +302,6 @@ static void CheckTick(uv_check_t* handle, int status) {
306302
Tick();
307303
}
308304

309-
310-
static void DoPoll(uv_idle_t* watcher, int status) {
311-
assert(watcher == &eio_poller);
312-
313-
//printf("eio_poller\n");
314-
315-
if (eio_poll() != -1 && uv_is_active((uv_handle_t*) &eio_poller)) {
316-
//printf("eio_poller stop\n");
317-
uv_idle_stop(&eio_poller);
318-
uv_unref();
319-
}
320-
}
321-
322-
323-
// Called from the main thread.
324-
static void WantPollNotifier(uv_async_t* watcher, int status) {
325-
assert(watcher == &eio_want_poll_notifier);
326-
327-
//printf("want poll notifier\n");
328-
329-
if (eio_poll() == -1 && !uv_is_active((uv_handle_t*) &eio_poller)) {
330-
//printf("eio_poller start\n");
331-
uv_idle_start(&eio_poller, node::DoPoll);
332-
uv_ref();
333-
}
334-
}
335-
336-
337-
static void DonePollNotifier(uv_async_t* watcher, int revents) {
338-
assert(watcher == &eio_done_poll_notifier);
339-
340-
//printf("done poll notifier\n");
341-
342-
if (eio_poll() != -1 && uv_is_active((uv_handle_t*) &eio_poller)) {
343-
//printf("eio_poller stop\n");
344-
uv_idle_stop(&eio_poller);
345-
uv_unref();
346-
}
347-
}
348-
349-
350-
// EIOWantPoll() is called from the EIO thread pool each time an EIO
351-
// request (that is, one of the node.fs.* functions) has completed.
352-
static void EIOWantPoll(void) {
353-
// Signal the main thread that eio_poll need to be processed.
354-
uv_async_send(&eio_want_poll_notifier);
355-
}
356-
357-
358-
static void EIODonePoll(void) {
359-
// Signal the main thread that we should stop calling eio_poll().
360-
// from the idle watcher.
361-
uv_async_send(&eio_done_poll_notifier);
362-
}
363-
364-
365305
static inline const char *errno_string(int errorno) {
366306
#define ERRNO_CASE(e) case e: return #e;
367307
switch (errorno) {
@@ -2517,23 +2457,6 @@ char** Init(int argc, char *argv[]) {
25172457
uv_timer_init(&node::gc_timer);
25182458
uv_unref();
25192459

2520-
// Setup the EIO thread pool. It requires 3, yes 3, watchers.
2521-
{
2522-
uv_idle_init(&node::eio_poller);
2523-
uv_idle_start(&eio_poller, node::DoPoll);
2524-
2525-
uv_async_init(&node::eio_want_poll_notifier, node::WantPollNotifier);
2526-
uv_unref();
2527-
2528-
uv_async_init(&node::eio_done_poll_notifier, node::DonePollNotifier);
2529-
uv_unref();
2530-
2531-
eio_init(node::EIOWantPoll, node::EIODonePoll);
2532-
// Don't handle more than 10 reqs on each eio_poll(). This is to avoid
2533-
// race conditions. See test/simple/test-eio-race.js
2534-
eio_set_max_poll_reqs(10);
2535-
}
2536-
25372460
V8::SetFatalErrorHandler(node::OnFatalError);
25382461

25392462

src/node.h

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#endif
4040

4141
#include <uv.h>
42-
#include <eio.h>
4342
#include <v8.h>
4443
#include <sys/types.h> /* struct stat */
4544
#include <sys/stat.h>

src/node_child_process.h

-2
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ class ChildProcess : ObjectWrap {
119119
#endif // __POSIX__
120120

121121
#ifdef __MINGW32__
122-
static int do_spawn(eio_req *req);
123-
static int after_spawn(eio_req *req);
124122
static void watch(ChildProcess *child);
125123
static void CALLBACK watch_wait_callback(void *data, BOOLEAN didTimeout);
126124
static void notify_spawn_failure(ChildProcess *child);

src/node_crypto.cc

+8-9
Original file line numberDiff line numberDiff line change
@@ -3770,7 +3770,7 @@ struct pbkdf2_req {
37703770
};
37713771

37723772
void
3773-
EIO_PBKDF2(eio_req* req) {
3773+
EIO_PBKDF2(uv_work_t* req) {
37743774
pbkdf2_req* request = (pbkdf2_req*)req->data;
37753775
request->err = PKCS5_PBKDF2_HMAC_SHA1(
37763776
request->pass,
@@ -3784,13 +3784,13 @@ EIO_PBKDF2(eio_req* req) {
37843784
memset(request->salt, 0, request->saltlen);
37853785
}
37863786

3787-
int
3788-
EIO_PBKDF2After(eio_req* req) {
3787+
void
3788+
EIO_PBKDF2After(uv_work_t* req) {
37893789
HandleScope scope;
37903790

3791-
uv_unref();
3792-
37933791
pbkdf2_req* request = (pbkdf2_req*)req->data;
3792+
delete req;
3793+
37943794
Handle<Value> argv[2];
37953795
if (request->err) {
37963796
argv[0] = Undefined();
@@ -3814,8 +3814,6 @@ EIO_PBKDF2After(eio_req* req) {
38143814
request->callback.Dispose();
38153815

38163816
delete request;
3817-
3818-
return 0;
38193817
}
38203818

38213819
Handle<Value>
@@ -3869,8 +3867,9 @@ PBKDF2(const Arguments& args) {
38693867
request->keylen = keylen;
38703868
request->callback = Persistent<Function>::New(callback);
38713869

3872-
eio_custom(EIO_PBKDF2, EIO_PRI_DEFAULT, EIO_PBKDF2After, request);
3873-
uv_ref();
3870+
uv_work_t* req = new uv_work_t();
3871+
uv_queue_work(req, EIO_PBKDF2, EIO_PBKDF2After);
3872+
req->data = request;
38743873

38753874
return Undefined();
38763875
}

0 commit comments

Comments
 (0)