mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
uv: upgrade to 10de090
This commit is contained in:
1 parent
18b92201be
commit
b24c515dbf
11 files changed
+96
-33
No files matched your search
Vendored
+1
@@ -38,3 +38,4 @@ Ryan Emery <seebees@gmail.com>
|
||||
Bruce Mitchener <bruce.mitchener@gmail.com>
|
||||
Maciej Małecki <maciej.malecki@notimplemented.org>
|
||||
Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||
Daisuke Murase <typester@cpan.org>
|
||||
+4
@@ -99,4 +99,8 @@ struct ngx_queue_s {
|
||||
(type *) ((unsigned char *) q - offsetof(type, link))
|
||||
|
||||
|
||||
#define ngx_queue_foreach(q, h) \
|
||||
for ((q) = ngx_queue_head(h); (q) != (h); (q) = ngx_queue_next(q))
|
||||
|
||||
|
||||
#endif /* _NGX_QUEUE_H_INCLUDED_ */
|
||||
Vendored
+3
@@ -44,6 +44,9 @@ typedef struct {
|
||||
|
||||
typedef int uv_file;
|
||||
|
||||
#define UV_ONCE_INIT PTHREAD_ONCE_INIT
|
||||
|
||||
typedef pthread_once_t uv_once_t;
|
||||
typedef pthread_t uv_thread_t;
|
||||
typedef pthread_mutex_t uv_mutex_t;
|
||||
typedef pthread_rwlock_t uv_rwlock_t;
|
||||
|
||||
Vendored
+10
@@ -152,6 +152,16 @@ typedef union {
|
||||
} fallback_;
|
||||
} uv_rwlock_t;
|
||||
|
||||
#define UV_ONCE_INIT { 0, NULL, NULL }
|
||||
|
||||
typedef struct uv_once_s {
|
||||
unsigned char ran;
|
||||
/* The actual event handle must be aligned to sizeof(HANDLE), so in */
|
||||
/* practice it might overlap padding a little. */
|
||||
HANDLE event;
|
||||
HANDLE padding;
|
||||
} uv_once_t;
|
||||
|
||||
/* Platform-specific definitions for uv_dlopen support. */
|
||||
typedef HMODULE uv_lib_t;
|
||||
#define UV_DYNAMIC FAR WINAPI
|
||||
|
||||
Vendored
+7
@@ -1339,9 +1339,16 @@ UV_EXTERN void uv_rwlock_wrlock(uv_rwlock_t* rwlock);
|
||||
UV_EXTERN int uv_rwlock_trywrlock(uv_rwlock_t* rwlock);
|
||||
UV_EXTERN void uv_rwlock_wrunlock(uv_rwlock_t* rwlock);
|
||||
|
||||
/* Runs a function once and only once. Concurrent calls to uv_once() with the
|
||||
* same guard will block all callers except one (it's unspecified which one).
|
||||
* The guard should be initialized statically with the UV_ONCE_INIT macro.
|
||||
*/
|
||||
UV_EXTERN void uv_once(uv_once_t* guard, void (*callback)(void));
|
||||
|
||||
UV_EXTERN int uv_thread_create(uv_thread_t *tid,
|
||||
void (*entry)(void *arg), void *arg);
|
||||
UV_EXTERN int uv_thread_join(uv_thread_t *tid);
|
||||
UV_EXTERN uv_thread_t uv_thread_self(void);
|
||||
|
||||
/* the presence of these unions force similar struct layout */
|
||||
union uv_any_handle {
|
||||
|
||||
Vendored
+30
-13
@@ -158,10 +158,30 @@ void uv_close(uv_handle_t* handle, uv_close_cb close_cb) {
|
||||
}
|
||||
|
||||
|
||||
uv_loop_t* uv_loop_new(void) {
|
||||
uv_loop_t* loop = calloc(1, sizeof(uv_loop_t));
|
||||
loop->ev = ev_loop_new(0);
|
||||
static int uv__loop_init(uv_loop_t* loop,
|
||||
struct ev_loop *(ev_loop_new)(unsigned int flags)) {
|
||||
memset(loop, 0, sizeof(*loop));
|
||||
#if HAVE_KQUEUE
|
||||
loop->ev = ev_loop_new(EVBACKEND_KQUEUE);
|
||||
#else
|
||||
loop->ev = ev_loop_new(EVFLAG_AUTO);
|
||||
#endif
|
||||
ev_set_userdata(loop->ev, loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
uv_loop_t* uv_loop_new(void) {
|
||||
uv_loop_t* loop;
|
||||
|
||||
if ((loop = malloc(sizeof(*loop))) == NULL)
|
||||
return NULL;
|
||||
|
||||
if (uv__loop_init(loop, ev_loop_new)) {
|
||||
free(loop);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return loop;
|
||||
}
|
||||
|
||||
@@ -182,16 +202,13 @@ void uv_loop_delete(uv_loop_t* loop) {
|
||||
|
||||
|
||||
uv_loop_t* uv_default_loop(void) {
|
||||
if (!default_loop_ptr) {
|
||||
default_loop_ptr = &default_loop_struct;
|
||||
#if HAVE_KQUEUE
|
||||
default_loop_struct.ev = ev_default_loop(EVBACKEND_KQUEUE);
|
||||
#else
|
||||
default_loop_struct.ev = ev_default_loop(EVFLAG_AUTO);
|
||||
#endif
|
||||
ev_set_userdata(default_loop_struct.ev, default_loop_ptr);
|
||||
}
|
||||
assert(default_loop_ptr->ev == EV_DEFAULT_UC);
|
||||
if (default_loop_ptr)
|
||||
return default_loop_ptr;
|
||||
|
||||
if (uv__loop_init(&default_loop_struct, ev_default_loop))
|
||||
return NULL;
|
||||
|
||||
default_loop_ptr = &default_loop_struct;
|
||||
return default_loop_ptr;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+23
-2
@@ -28,7 +28,12 @@
|
||||
#include <ifaddrs.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#include <TargetConditionals.h>
|
||||
|
||||
#if !TARGET_OS_IPHONE
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#endif
|
||||
|
||||
#include <mach/mach.h>
|
||||
#include <mach/mach_time.h>
|
||||
#include <mach-o/dyld.h> /* _NSGetExecutablePath */
|
||||
@@ -36,10 +41,26 @@
|
||||
#include <sys/sysctl.h>
|
||||
#include <unistd.h> /* sysconf */
|
||||
|
||||
|
||||
static char *process_title;
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
/* see: http://developer.apple.com/library/mac/#qa/qa1398/_index.html */
|
||||
uint64_t uv_hrtime() {
|
||||
uint64_t time;
|
||||
uint64_t enano;
|
||||
static mach_timebase_info_data_t sTimebaseInfo;
|
||||
|
||||
time = mach_absolute_time();
|
||||
|
||||
if (0 == sTimebaseInfo.denom) {
|
||||
(void)mach_timebase_info(&sTimebaseInfo);
|
||||
}
|
||||
|
||||
enano = time * sTimebaseInfo.numer / sTimebaseInfo.denom;
|
||||
|
||||
return enano;
|
||||
}
|
||||
#else
|
||||
uint64_t uv_hrtime() {
|
||||
uint64_t time;
|
||||
Nanoseconds enano;
|
||||
@@ -47,7 +68,7 @@ uint64_t uv_hrtime() {
|
||||
enano = AbsoluteToNanoseconds(*(AbsoluteTime *)&time);
|
||||
return (*(uint64_t *)&enano);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int uv_exepath(char* buffer, size_t* size) {
|
||||
uint32_t usize;
|
||||
|
||||
Vendored
+9
@@ -47,6 +47,10 @@ int uv_thread_join(uv_thread_t *tid) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uv_thread_t uv_thread_self(void) {
|
||||
return pthread_self();
|
||||
}
|
||||
|
||||
|
||||
int uv_mutex_init(uv_mutex_t* mutex) {
|
||||
if (pthread_mutex_init(mutex, NULL))
|
||||
@@ -147,3 +151,8 @@ int uv_rwlock_trywrlock(uv_rwlock_t* rwlock) {
|
||||
void uv_rwlock_wrunlock(uv_rwlock_t* rwlock) {
|
||||
CHECK(pthread_rwlock_unlock(rwlock));
|
||||
}
|
||||
|
||||
|
||||
void uv_once(uv_once_t* guard, void (*callback)(void)) {
|
||||
CHECK(pthread_once(guard, callback));
|
||||
}
|
||||
Vendored
-18
@@ -343,22 +343,4 @@ extern int uv_allow_ipv6;
|
||||
extern struct sockaddr_in uv_addr_ip4_any_;
|
||||
extern struct sockaddr_in6 uv_addr_ip6_any_;
|
||||
|
||||
|
||||
/*
|
||||
* Threads and synchronization
|
||||
*/
|
||||
typedef struct uv_once_s {
|
||||
unsigned char ran;
|
||||
/* The actual event handle must be aligned to sizeof(HANDLE), so in */
|
||||
/* practice it might overlap padding a little. */
|
||||
HANDLE event;
|
||||
HANDLE padding;
|
||||
} uv_once_t;
|
||||
|
||||
#define UV_ONCE_INIT \
|
||||
{ 0, NULL, NULL }
|
||||
|
||||
void uv_once(uv_once_t* guard, void (*callback)(void));
|
||||
|
||||
|
||||
#endif /* UV_WIN_INTERNAL_H_ */
|
||||
Vendored
+2
@@ -122,6 +122,7 @@ TEST_DECLARE (threadpool_queue_work_simple)
|
||||
TEST_DECLARE (thread_mutex)
|
||||
TEST_DECLARE (thread_rwlock)
|
||||
TEST_DECLARE (thread_create)
|
||||
TEST_DECLARE (thread_self)
|
||||
TEST_DECLARE (strlcpy)
|
||||
TEST_DECLARE (strlcat)
|
||||
TEST_DECLARE (counters_init)
|
||||
@@ -287,6 +288,7 @@ TASK_LIST_START
|
||||
TEST_ENTRY (thread_mutex)
|
||||
TEST_ENTRY (thread_rwlock)
|
||||
TEST_ENTRY (thread_create)
|
||||
TEST_ENTRY (thread_self)
|
||||
TEST_ENTRY (strlcpy)
|
||||
TEST_ENTRY (strlcat)
|
||||
TEST_ENTRY (counters_init)
|
||||
|
||||
Vendored
+7
@@ -49,3 +49,10 @@ TEST_IMPL(thread_create) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(thread_self) {
|
||||
uv_thread_t tid;
|
||||
tid = uv_thread_self();
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user