mirror of https://github.com/nodejs/node.git
deps: upgrade libuv to 2ec0986
parent
1f3e4a76f9
commit
0fd2834539
|
@ -52,11 +52,12 @@ int uv_timer_init(uv_loop_t* loop, uv_timer_t* timer) {
|
|||
}
|
||||
|
||||
|
||||
int uv_timer_start(uv_timer_t* timer, uv_timer_cb cb, int64_t timeout,
|
||||
int64_t repeat) {
|
||||
if (uv__is_active(timer)) {
|
||||
return -1;
|
||||
}
|
||||
int uv_timer_start(uv_timer_t* timer,
|
||||
uv_timer_cb cb,
|
||||
int64_t timeout,
|
||||
int64_t repeat) {
|
||||
if (uv__is_active(timer))
|
||||
uv_timer_stop(timer);
|
||||
|
||||
timer->timer_cb = cb;
|
||||
|
||||
|
|
|
@ -155,16 +155,14 @@ UNUSED static int uv__is_active(const uv_handle_t* h) {
|
|||
|
||||
UNUSED static void uv__handle_start(uv_handle_t* h) {
|
||||
if (h->flags & UV__ACTIVE) return;
|
||||
if (!(h->flags & UV__REF)) return;
|
||||
if (h->flags & UV__REF) uv__active_handle_add(h);
|
||||
h->flags |= UV__ACTIVE;
|
||||
uv__active_handle_add(h);
|
||||
}
|
||||
#define uv__handle_start(h) uv__handle_start((uv_handle_t*)(h))
|
||||
|
||||
UNUSED static void uv__handle_stop(uv_handle_t* h) {
|
||||
if (!(h->flags & UV__ACTIVE)) return;
|
||||
if (!(h->flags & UV__REF)) return;
|
||||
uv__active_handle_rm(h);
|
||||
if (h->flags & UV__REF) uv__active_handle_rm(h);
|
||||
h->flags &= ~UV__ACTIVE;
|
||||
}
|
||||
#define uv__handle_stop(h) uv__handle_stop((uv_handle_t*)(h))
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "runner.h"
|
||||
|
@ -92,6 +93,11 @@ int run_test(const char* test, int timeout, int benchmark_output) {
|
|||
main_proc = NULL;
|
||||
process_count = 0;
|
||||
|
||||
#ifndef _WIN32
|
||||
/* Clean up stale socket from previous run. */
|
||||
remove(TEST_PIPENAME);
|
||||
#endif
|
||||
|
||||
/* If it's a helper the user asks for, start it directly. */
|
||||
for (task = TASKS; task->main; task++) {
|
||||
if (task->is_helper && strcmp(test, task->process_name) == 0) {
|
||||
|
|
|
@ -120,11 +120,6 @@ TEST_IMPL(ipc_send_recv_pipe) {
|
|||
r = uv_pipe_init(uv_default_loop(), &ctx.send.pipe, 1);
|
||||
ASSERT(r == 0);
|
||||
|
||||
#ifndef _WIN32
|
||||
/* Clean up stale socket from previous test run. */
|
||||
remove(TEST_PIPENAME);
|
||||
#endif
|
||||
|
||||
r = uv_pipe_bind(&ctx.send.pipe, TEST_PIPENAME);
|
||||
ASSERT(r == 0);
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ TEST_DECLARE (callback_stack)
|
|||
TEST_DECLARE (error_message)
|
||||
TEST_DECLARE (timer)
|
||||
TEST_DECLARE (timer_again)
|
||||
TEST_DECLARE (timer_start_twice)
|
||||
TEST_DECLARE (idle_starvation)
|
||||
TEST_DECLARE (loop_handles)
|
||||
TEST_DECLARE (get_loadavg)
|
||||
|
@ -266,6 +267,7 @@ TASK_LIST_START
|
|||
|
||||
TEST_ENTRY (timer)
|
||||
TEST_ENTRY (timer_again)
|
||||
TEST_ENTRY (timer_start_twice)
|
||||
|
||||
TEST_ENTRY (idle_starvation)
|
||||
|
||||
|
|
|
@ -27,10 +27,8 @@
|
|||
|
||||
#ifdef _WIN32
|
||||
# define BAD_PIPENAME "bad-pipe"
|
||||
# define UNLINK_PIPE(name)
|
||||
#else
|
||||
# define BAD_PIPENAME "/path/to/unix/socket/that/really/should/not/be/there"
|
||||
# define UNLINK_PIPE(name) remove(name)
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -47,8 +45,6 @@ TEST_IMPL(pipe_bind_error_addrinuse) {
|
|||
uv_pipe_t server1, server2;
|
||||
int r;
|
||||
|
||||
UNLINK_PIPE(TEST_PIPENAME);
|
||||
|
||||
r = uv_pipe_init(uv_default_loop(), &server1, 0);
|
||||
ASSERT(r == 0);
|
||||
r = uv_pipe_bind(&server1, TEST_PIPENAME);
|
||||
|
|
|
@ -35,6 +35,7 @@ static void once_close_cb(uv_handle_t* handle) {
|
|||
printf("ONCE_CLOSE_CB\n");
|
||||
|
||||
ASSERT(handle != NULL);
|
||||
ASSERT(!uv_is_active(handle));
|
||||
|
||||
once_close_cb_called++;
|
||||
}
|
||||
|
@ -45,6 +46,7 @@ static void once_cb(uv_timer_t* handle, int status) {
|
|||
|
||||
ASSERT(handle != NULL);
|
||||
ASSERT(status == 0);
|
||||
ASSERT(!uv_is_active((uv_handle_t*)handle));
|
||||
|
||||
once_cb_called++;
|
||||
|
||||
|
@ -69,6 +71,7 @@ static void repeat_cb(uv_timer_t* handle, int status) {
|
|||
|
||||
ASSERT(handle != NULL);
|
||||
ASSERT(status == 0);
|
||||
ASSERT(uv_is_active((uv_handle_t*)handle));
|
||||
|
||||
repeat_cb_called++;
|
||||
|
||||
|
@ -128,3 +131,22 @@ TEST_IMPL(timer) {
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(timer_start_twice) {
|
||||
uv_timer_t once;
|
||||
int r;
|
||||
|
||||
r = uv_timer_init(uv_default_loop(), &once);
|
||||
ASSERT(r == 0);
|
||||
r = uv_timer_start(&once, never_cb, 86400 * 1000, 0);
|
||||
ASSERT(r == 0);
|
||||
r = uv_timer_start(&once, once_cb, 10, 0);
|
||||
ASSERT(r == 0);
|
||||
r = uv_run(uv_default_loop());
|
||||
ASSERT(r == 0);
|
||||
|
||||
ASSERT(once_cb_called == 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue