Go to the documentation of this file.
28 #if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR)
43 #if defined(_DEBUG) && (defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR))
50 static int uv__crt_dbg_report_handler(
int report_type,
char *
message,
int *ret_val) {
59 if(IsDebuggerPresent())
73 #if !defined(__MINGW32__) || __MSVCRT_VERSION__ >= 0x800
75 const wchar_t*
function,
const wchar_t *
file,
unsigned int line,
84 #define UV__LOOPS_CHUNK_SIZE 8
101 goto failed_loops_realloc;
113 failed_loops_realloc:
115 return ERROR_OUTOFMEMORY;
120 int smaller_capacity;
171 PostQueuedCompletionStatus(
loop->iocp, 0, 0, NULL);
178 SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |
179 SEM_NOOPENFILEERRORBOX);
184 #if !defined(__MINGW32__) || __MSVCRT_VERSION__ >= 0x800
192 #if defined(_DEBUG) && (defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR))
193 _CrtSetReportHook(uv__crt_dbg_report_handler);
233 if (
loop->iocp == NULL)
244 loop->active_reqs.count = 0;
245 loop->active_handles = 0;
247 loop->pending_reqs_tail = NULL;
249 loop->endgame_handles = NULL;
254 goto fail_timers_alloc;
259 loop->check_handles = NULL;
260 loop->prepare_handles = NULL;
261 loop->idle_handles = NULL;
263 loop->next_prepare_handle = NULL;
264 loop->next_check_handle = NULL;
265 loop->next_idle_handle = NULL;
267 memset(&
loop->poll_peer_sockets, 0,
sizeof loop->poll_peer_sockets);
269 loop->active_tcp_streams = 0;
270 loop->active_udp_streams = 0;
272 loop->timer_counter = 0;
277 goto fail_mutex_init;
281 goto fail_async_init;
288 goto fail_async_init;
297 loop->timer_heap = NULL;
300 CloseHandle(
loop->iocp);
309 assert(new_time >=
loop->time);
310 loop->time = new_time;
330 loop->wq_async.async_sent = 0;
331 loop->wq_async.close_cb = NULL;
336 SOCKET sock =
loop->poll_peer_sockets[
i];
337 if (sock != 0 && sock != INVALID_SOCKET)
348 loop->timer_heap = NULL;
350 CloseHandle(
loop->iocp);
370 if (
loop->stop_flag != 0)
376 if (
loop->pending_reqs_tail)
379 if (
loop->endgame_handles)
382 if (
loop->idle_handles)
392 OVERLAPPED* overlapped;
399 for (repeat = 0; ; repeat++) {
400 GetQueuedCompletionStatus(
loop->iocp,
415 }
else if (GetLastError() != WAIT_TIMEOUT) {
423 if (timeout_time >
loop->time) {
431 timeout += repeat ? (1 << (repeat - 1)) : 0;
443 OVERLAPPED_ENTRY overlappeds[128];
451 for (repeat = 0; ; repeat++) {
452 success = GetQueuedCompletionStatusEx(
loop->iocp,
464 if (overlappeds[
i].lpOverlapped) {
474 }
else if (GetLastError() != WAIT_TIMEOUT) {
482 if (timeout_time >
loop->time) {
490 timeout += repeat ? (1 << (repeat - 1)) : 0;
502 loop->endgame_handles != NULL;
520 while (
r != 0 &&
loop->stop_flag == 0) {
561 if (
loop->stop_flag != 0)
612 if (
handle->type == UV_TCP)
614 else if (
handle->type == UV_UDP)
619 len =
sizeof(*value);
626 if (
r == SOCKET_ERROR)
633 return (
int)(
sizeof(DWORD_PTR) * 8);
638 struct sockaddr*
name,
#define ARRAY_SIZE(array)
static INLINE void uv_process_endgames(uv_loop_t *loop)
return memset(p, 0, total)
void uv_update_time(uv_loop_t *loop)
void uv__work_done(uv_async_t *handle)
static struct heap * timer_heap(const uv_loop_t *loop)
void * uv__malloc(size_t size)
UV_EXTERN int uv_mutex_init(uv_mutex_t *handle)
void uv_winsock_init(void)
void uv_signals_init(void)
UV_EXTERN void uv_mutex_destroy(uv_mutex_t *handle)
uint64_t uv__hrtime(uv_clocktype_t type)
static void uv__loops_remove(uv_loop_t *loop)
void uv_prepare_invoke(uv_loop_t *loop)
#define uv__handle_close(handle)
#define uv__has_active_handles(loop)
int uv_run(uv_loop_t *loop, uv_run_mode mode)
void uv_check_invoke(uv_loop_t *loop)
UV_EXTERN int uv_is_closing(const uv_handle_t *handle)
#define uv__handle_unref(h)
UV_THREAD_LOCAL int uv__crt_assert_enabled
static void uv__poll(uv_loop_t *loop, DWORD timeout)
int uv__socket_sockopt(uv_handle_t *handle, int optname, int *value)
int uv_loop_alive(const uv_loop_t *loop)
#define uv__handle_closing(handle)
#define UV__LOOPS_CHUNK_SIZE
int uv__loop_configure(uv_loop_t *loop, uv_loop_option option, va_list ap)
void uv_winapi_init(void)
void uv_console_init(void)
UV_EXTERN void uv_once(uv_once_t *guard, void(*callback)(void))
UV_EXTERN int uv_translate_sys_error(int sys_errno)
int uv_loop_fork(uv_loop_t *loop)
unsigned __int64 uint64_t
static INLINE int uv_process_reqs(uv_loop_t *loop)
static int uv__loops_size
int uv_cpumask_size(void)
static uv_mutex_t uv__loops_lock
pthread_mutex_t uv_mutex_t
int uv_backend_timeout(const uv_loop_t *loop)
_W64 unsigned int uintptr_t
int uv__next_timeout(const uv_loop_t *loop)
UV_EXTERN void uv_mutex_unlock(uv_mutex_t *handle)
void * uv__realloc(void *ptr, size_t size)
#define uv__has_active_reqs(loop)
static int uv__loops_add(uv_loop_t *loop)
static void uv__loops_init(void)
static INLINE void uv_insert_pending_req(uv_loop_t *loop, uv_req_t *req)
void uv__loop_close(uv_loop_t *loop)
void uv_fatal_error(const int errorno, const char *syscall)
sGetQueuedCompletionStatusEx pGetQueuedCompletionStatusEx
UV_EXTERN int uv_async_init(uv_loop_t *, uv_async_t *async, uv_async_cb async_cb)
static void uv__poll_wine(uv_loop_t *loop, DWORD timeout)
UV_EXTERN void uv_mutex_lock(uv_mutex_t *handle)
int(* uv__peersockfunc)(int, struct sockaddr *, socklen_t *)
static INLINE uv_req_t * uv_overlapped_to_req(OVERLAPPED *overlapped)
static void uv_init(void)
int uv__getsockpeername(const uv_handle_t *handle, uv__peersockfunc func, struct sockaddr *name, int *namelen, int delayed_error)
static int uv__loop_alive(const uv_loop_t *loop)
int uv_fileno(const uv_handle_t *handle, uv_os_fd_t *fd)
#define INVALID_HANDLE_VALUE
void uv_idle_invoke(uv_loop_t *loop)
int uv_backend_fd(const uv_loop_t *loop)
void uv__wake_all_loops(void)
static int closesocket(int sock)
void uv__init_detect_system_wakeup(void)
static uv_loop_t ** uv__loops
static uv_once_t uv_init_guard_
void uv__run_timers(uv_loop_t *loop)
int uv_loop_init(uv_loop_t *loop)
static int uv__loops_capacity
static void uv__crt_invalid_parameter_handler(const wchar_t *expression, const wchar_t *function, const wchar_t *file, unsigned int line, uintptr_t reserved)
grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:04