MCPcopy Create free account
hub / github.com/apache/cloudberry / handle_sigint

Function handle_sigint

src/fe_utils/cancel.c:152–178  ·  view source on GitHub ↗

* handle_sigint * * Handle interrupt signals by canceling the current command, if cancelConn * is set. */

Source from the content-addressed store, hash-verified

150 * is set.
151 */
152static void
153handle_sigint(SIGNAL_ARGS)
154{
155 int save_errno = errno;
156 char errbuf[256];
157
158 CancelRequested = true;
159
160 if (cancel_callback != NULL)
161 cancel_callback();
162
163 /* Send QueryCancel if we are processing a database query */
164 if (cancelConn != NULL)
165 {
166 if (PQcancel(cancelConn, errbuf, sizeof(errbuf)))
167 {
168 write_stderr(cancel_sent_msg);
169 }
170 else
171 {
172 write_stderr(cancel_not_sent_msg);
173 write_stderr(errbuf);
174 }
175 }
176
177 errno = save_errno; /* just in case the write changed it */
178}
179
180/*
181 * setup_cancel_handler

Callers

nothing calls this directly

Calls 2

PQcancelFunction · 0.85
write_stderrFunction · 0.50

Tested by

no test coverage detected