MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / uv__io_fork

Function uv__io_fork

third-party/libuv-1.46.0/src/unix/kqueue.c:66–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64#endif
65
66int uv__io_fork(uv_loop_t* loop) {
67 int err;
68 loop->backend_fd = -1;
69 err = uv__kqueue_init(loop);
70 if (err)
71 return err;
72
73#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
74 if (loop->cf_state != NULL) {
75 /* We cannot start another CFRunloop and/or thread in the child
76 process; CF aborts if you try or if you try to touch the thread
77 at all to kill it. So the best we can do is ignore it from now
78 on. This means we can't watch directories in the same way
79 anymore (like other BSDs). It also means we cannot properly
80 clean up the allocated resources; calling
81 uv__fsevents_loop_delete from uv_loop_close will crash the
82 process. So we sidestep the issue by pretending like we never
83 started it in the first place.
84 */
85 atomic_store_explicit(&uv__has_forked_with_cfrunloop,
86 1,
87 memory_order_relaxed);
88 uv__free(loop->cf_state);
89 loop->cf_state = NULL;
90 }
91#endif /* #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 */
92 return err;
93}
94
95
96int uv__io_check_fd(uv_loop_t* loop, int fd) {

Callers

nothing calls this directly

Calls 2

uv__kqueue_initFunction · 0.85
uv__freeFunction · 0.85

Tested by

no test coverage detected