MCPcopy Create free account
hub / github.com/ddopson/node-segfault-handler / send

Function send

src/segfault-handler.cpp:105–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103 }
104
105 void send(void * const* stack, size_t stack_size, int signo, long addr) {
106 // create the callback arguments
107 callback_args* args = new callback_args(&callback, stack, stack_size, signo, addr);
108
109 // set the handle data so these args are accessible to make_callback
110 handle->data = (void *) args;
111
112 // directly execute the callback if we're on the main thread,
113 // otherwise have uv send it and await the mutex
114 if (Isolate::GetCurrent()) {
115 #if defined(UV_VERSION_MAJOR) && UV_VERSION_MAJOR > 0
116 make_callback(handle);
117 #else
118 make_callback(handle, 0);
119 #endif
120 } else {
121 // lock the callback mutex
122 pthread_mutex_lock(&args->mutex);
123
124 // trigger the async callback
125 uv_async_send(handle);
126
127 // wait for it to finish
128 pthread_cond_wait(&args->cond, &args->mutex);
129
130 // unlock the callback mutex
131 pthread_mutex_unlock(&args->mutex);
132 }
133
134 // free the callback args
135 delete args;
136 }
137
138 static void close_callback(uv_handle_t* handle) {
139 // free the callback handle

Callers

nothing calls this directly

Calls 1

make_callbackFunction · 0.85

Tested by

no test coverage detected