Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Use new uv_fs_ apis
Browse files Browse the repository at this point in the history
This will cause master to be unstable for a while as we replace existing eio
calls with uv_fs calls.
  • Loading branch information
Igor Zinkovsky authored and ry committed Aug 30, 2011
1 parent 1088638 commit bce41fa
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 849 deletions.
504 changes: 0 additions & 504 deletions deps/pthread-win32/COPYING.LIB

This file was deleted.

Binary file removed deps/pthread-win32/libpthreadGC2.a
Binary file not shown.
Binary file removed deps/pthread-win32/libpthreadGC2d.a
Binary file not shown.
9 changes: 0 additions & 9 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,9 @@
'src/req_wrap.h',
'src/stream_wrap.h',
'src/v8_typed_array.h',
'deps/uv/src/eio/ecb.h',
'deps/uv/include/eio.h',
'deps/http_parser/http_parser.h',
'deps/v8/include/v8.h',
'deps/v8/include/v8-debug.h',
'deps/uv/src/eio/xthread.h',
'<(SHARED_INTERMEDIATE_DIR)/node_natives.h',
],

Expand All @@ -104,19 +101,13 @@
}],

[ 'OS=="win"', {
'dependencies': [
'deps/uv/deps/pthread-win32/pthread-win32.gyp:pthread-win32',
],
'sources': [
'src/platform_win32.cc',
'src/node_stdio_win32.cc',
# file operations depend on eio to link. uv contains eio in unix builds, but not win32. So we need to compile it here instead.
'deps/uv/src/eio/eio.c',
# headers to make for a more pleasant IDE experience
'src/platform_win32.h',
],
'defines': [
'PTW32_STATIC_LIB',
'FD_SETSIZE=1024',
# we need to use node's preferred "win32" rather than gyp's preferred "win"
'PLATFORM="win32"',
Expand Down
77 changes: 0 additions & 77 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,6 @@ static uv_idle_t tick_spinner;
static bool need_tick_cb;
static Persistent<String> tick_callback_sym;

static uv_async_t eio_want_poll_notifier;
static uv_async_t eio_done_poll_notifier;
static uv_idle_t eio_poller;


static bool use_uv = true;

Expand Down Expand Up @@ -306,62 +302,6 @@ static void CheckTick(uv_check_t* handle, int status) {
Tick();
}


static void DoPoll(uv_idle_t* watcher, int status) {
assert(watcher == &eio_poller);

//printf("eio_poller\n");

if (eio_poll() != -1 && uv_is_active((uv_handle_t*) &eio_poller)) {
//printf("eio_poller stop\n");
uv_idle_stop(&eio_poller);
uv_unref();
}
}


// Called from the main thread.
static void WantPollNotifier(uv_async_t* watcher, int status) {
assert(watcher == &eio_want_poll_notifier);

//printf("want poll notifier\n");

if (eio_poll() == -1 && !uv_is_active((uv_handle_t*) &eio_poller)) {
//printf("eio_poller start\n");
uv_idle_start(&eio_poller, node::DoPoll);
uv_ref();
}
}


static void DonePollNotifier(uv_async_t* watcher, int revents) {
assert(watcher == &eio_done_poll_notifier);

//printf("done poll notifier\n");

if (eio_poll() != -1 && uv_is_active((uv_handle_t*) &eio_poller)) {
//printf("eio_poller stop\n");
uv_idle_stop(&eio_poller);
uv_unref();
}
}


// EIOWantPoll() is called from the EIO thread pool each time an EIO
// request (that is, one of the node.fs.* functions) has completed.
static void EIOWantPoll(void) {
// Signal the main thread that eio_poll need to be processed.
uv_async_send(&eio_want_poll_notifier);
}


static void EIODonePoll(void) {
// Signal the main thread that we should stop calling eio_poll().
// from the idle watcher.
uv_async_send(&eio_done_poll_notifier);
}


static inline const char *errno_string(int errorno) {
#define ERRNO_CASE(e) case e: return #e;
switch (errorno) {
Expand Down Expand Up @@ -2517,23 +2457,6 @@ char** Init(int argc, char *argv[]) {
uv_timer_init(&node::gc_timer);
uv_unref();

// Setup the EIO thread pool. It requires 3, yes 3, watchers.
{
uv_idle_init(&node::eio_poller);
uv_idle_start(&eio_poller, node::DoPoll);

uv_async_init(&node::eio_want_poll_notifier, node::WantPollNotifier);
uv_unref();

uv_async_init(&node::eio_done_poll_notifier, node::DonePollNotifier);
uv_unref();

eio_init(node::EIOWantPoll, node::EIODonePoll);
// Don't handle more than 10 reqs on each eio_poll(). This is to avoid
// race conditions. See test/simple/test-eio-race.js
eio_set_max_poll_reqs(10);
}

V8::SetFatalErrorHandler(node::OnFatalError);


Expand Down
1 change: 0 additions & 1 deletion src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#endif

#include <uv.h>
#include <eio.h>
#include <v8.h>
#include <sys/types.h> /* struct stat */
#include <sys/stat.h>
Expand Down
2 changes: 0 additions & 2 deletions src/node_child_process.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ class ChildProcess : ObjectWrap {
#endif // __POSIX__

#ifdef __MINGW32__
static int do_spawn(eio_req *req);
static int after_spawn(eio_req *req);
static void watch(ChildProcess *child);
static void CALLBACK watch_wait_callback(void *data, BOOLEAN didTimeout);
static void notify_spawn_failure(ChildProcess *child);
Expand Down
17 changes: 8 additions & 9 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3770,7 +3770,7 @@ struct pbkdf2_req {
};

void
EIO_PBKDF2(eio_req* req) {
EIO_PBKDF2(uv_work_t* req) {
pbkdf2_req* request = (pbkdf2_req*)req->data;
request->err = PKCS5_PBKDF2_HMAC_SHA1(
request->pass,
Expand All @@ -3784,13 +3784,13 @@ EIO_PBKDF2(eio_req* req) {
memset(request->salt, 0, request->saltlen);
}

int
EIO_PBKDF2After(eio_req* req) {
void
EIO_PBKDF2After(uv_work_t* req) {
HandleScope scope;

uv_unref();

pbkdf2_req* request = (pbkdf2_req*)req->data;
delete req;

Handle<Value> argv[2];
if (request->err) {
argv[0] = Undefined();
Expand All @@ -3814,8 +3814,6 @@ EIO_PBKDF2After(eio_req* req) {
request->callback.Dispose();

delete request;

return 0;
}

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

eio_custom(EIO_PBKDF2, EIO_PRI_DEFAULT, EIO_PBKDF2After, request);
uv_ref();
uv_work_t* req = new uv_work_t();
uv_queue_work(req, EIO_PBKDF2, EIO_PBKDF2After);
req->data = request;

return Undefined();
}
Expand Down
Loading

0 comments on commit bce41fa

Please sign in to comment.