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

Commit

Permalink
uv: upgrade to 1e32cb0
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Oct 17, 2012
1 parent 4b238b4 commit c11c19b
Show file tree
Hide file tree
Showing 82 changed files with 856 additions and 210 deletions.
2 changes: 1 addition & 1 deletion deps/uv/common.gypi
Expand Up @@ -15,7 +15,7 @@
'configurations': {
'Debug': {
'defines': [ 'DEBUG', '_DEBUG' ],
'cflags': [ '-g', '-O0' ],
'cflags': [ '-g', '-O0', '-fwrapv' ],
'msvs_settings': {
'VCCLCompilerTool': {
'target_conditions': [
Expand Down
16 changes: 13 additions & 3 deletions deps/uv/include/uv-private/uv-unix.h
Expand Up @@ -156,7 +156,8 @@ typedef struct {
struct uv_timer_s* rbh_root; \
} timer_handles; \
uint64_t time; \
void* signal_ctx; \
int signal_pipefd[2]; \
uv__io_t signal_io_watcher; \
uv_signal_t child_watcher; \
int emfile_fd; \
UV_PLATFORM_LOOP_FIELDS \
Expand Down Expand Up @@ -242,7 +243,7 @@ typedef struct {
ngx_queue_t queue;

#define UV_TIMER_PRIVATE_FIELDS \
/* RB_ENTRY(uv_timer_s) node; */ \
/* RB_ENTRY(uv_timer_s) tree_entry; */ \
struct { \
struct uv_timer_s* rbe_left; \
struct uv_timer_s* rbe_right; \
Expand Down Expand Up @@ -289,7 +290,16 @@ typedef struct {
int mode;

#define UV_SIGNAL_PRIVATE_FIELDS \
ngx_queue_t queue;
/* RB_ENTRY(uv_signal_s) tree_entry; */ \
struct { \
struct uv_signal_s* rbe_left; \
struct uv_signal_s* rbe_right; \
struct uv_signal_s* rbe_parent; \
int rbe_color; \
} tree_entry; \
/* Use two counters here so we don have to fiddle with atomics. */ \
unsigned int caught_signals; \
unsigned int dispatched_signals;

#define UV_FS_EVENT_PRIVATE_FIELDS \
uv_fs_event_cb cb; \
Expand Down
1 change: 0 additions & 1 deletion deps/uv/src/unix/async.c
Expand Up @@ -30,7 +30,6 @@ static int uv__async_init(uv_loop_t* loop);
static void uv__async_io(uv_loop_t* loop, uv__io_t* handle, int events);


__attribute__((always_inline))
static int uv__async_make_pending(volatile sig_atomic_t* ptr) {
/* Do a cheap read first. */
if (*ptr)
Expand Down
16 changes: 13 additions & 3 deletions deps/uv/src/unix/core.c
Expand Up @@ -65,6 +65,9 @@ static uv_loop_t* default_loop_ptr;


void uv_close(uv_handle_t* handle, uv_close_cb close_cb) {
assert(!(handle->flags & (UV_CLOSING | UV_CLOSED)));

handle->flags |= UV_CLOSING;
handle->close_cb = close_cb;

switch (handle->type) {
Expand Down Expand Up @@ -121,15 +124,22 @@ void uv_close(uv_handle_t* handle, uv_close_cb close_cb) {
break;

case UV_SIGNAL:
uv__signal_close((uv_signal_t*)handle);
break;
uv__signal_close((uv_signal_t*) handle);
/* Signal handles may not be closed immediately. The signal code will */
/* itself close uv__make_close_pending whenever appropriate. */
return;

default:
assert(0);
}

handle->flags |= UV_CLOSING;
uv__make_close_pending(handle);
}


void uv__make_close_pending(uv_handle_t* handle) {
assert(handle->flags & UV_CLOSING);
assert(!(handle->flags & UV_CLOSED));
handle->next_closing = handle->loop->closing_handles;
handle->loop->closing_handles = handle;
}
Expand Down
5 changes: 3 additions & 2 deletions deps/uv/src/unix/internal.h
Expand Up @@ -101,7 +101,6 @@ enum {
};

__attribute__((unused))
__attribute__((always_inline))
static void uv__req_init(uv_loop_t* loop, uv_req_t* req, uv_req_type type) {
req->type = type;
uv__req_register(loop, req);
Expand All @@ -116,6 +115,7 @@ int uv__cloexec(int fd, int set);
int uv__socket(int domain, int type, int protocol);
int uv__dup(int fd);
int uv_async_stop(uv_async_t* handle);
void uv__make_close_pending(uv_handle_t* handle);

void uv__io_init(uv__io_t* handle, uv__io_cb cb, int fd, int events);
void uv__io_set(uv__io_t* handle, uv__io_cb cb, int fd, int events);
Expand Down Expand Up @@ -157,7 +157,8 @@ unsigned int uv__next_timeout(uv_loop_t* loop);

/* signal */
void uv__signal_close(uv_signal_t* handle);
void uv__signal_unregister(uv_loop_t* loop);
void uv__signal_global_once_init(void);
void uv__signal_loop_cleanup();

/* thread pool */
void uv__work_submit(uv_loop_t* loop,
Expand Down
7 changes: 5 additions & 2 deletions deps/uv/src/unix/loop.c
Expand Up @@ -31,6 +31,8 @@ int uv__loop_init(uv_loop_t* loop, int default_loop) {
unsigned int i;
int flags;

uv__signal_global_once_init();

#if HAVE_KQUEUE
flags = EVBACKEND_KQUEUE;
#else
Expand All @@ -47,10 +49,11 @@ int uv__loop_init(uv_loop_t* loop, int default_loop) {
ngx_queue_init(&loop->prepare_handles);
ngx_queue_init(&loop->handle_queue);
loop->closing_handles = NULL;
loop->signal_ctx = NULL;
loop->time = uv_hrtime() / 1000000;
loop->async_pipefd[0] = -1;
loop->async_pipefd[1] = -1;
loop->signal_pipefd[0] = -1;
loop->signal_pipefd[1] = -1;
loop->emfile_fd = -1;
loop->ev = (default_loop ? ev_default_loop : ev_loop_new)(flags);
ev_set_userdata(loop->ev, loop);
Expand Down Expand Up @@ -79,8 +82,8 @@ int uv__loop_init(uv_loop_t* loop, int default_loop) {


void uv__loop_delete(uv_loop_t* loop) {
uv__signal_loop_cleanup(loop);
uv__platform_loop_delete(loop);
uv__signal_unregister(loop);
ev_loop_destroy(loop->ev);

if (loop->async_pipefd[0] != -1) {
Expand Down

0 comments on commit c11c19b

Please sign in to comment.