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

Function consoleHandler

src/fe_utils/cancel.c:197–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195#else /* WIN32 */
196
197static BOOL WINAPI
198consoleHandler(DWORD dwCtrlType)
199{
200 char errbuf[256];
201
202 if (dwCtrlType == CTRL_C_EVENT ||
203 dwCtrlType == CTRL_BREAK_EVENT)
204 {
205 CancelRequested = true;
206
207 if (cancel_callback != NULL)
208 cancel_callback();
209
210 /* Send QueryCancel if we are processing a database query */
211 EnterCriticalSection(&cancelConnLock);
212 if (cancelConn != NULL)
213 {
214 if (PQcancel(cancelConn, errbuf, sizeof(errbuf)))
215 {
216 write_stderr(cancel_sent_msg);
217 }
218 else
219 {
220 write_stderr(cancel_not_sent_msg);
221 write_stderr(errbuf);
222 }
223 }
224
225 LeaveCriticalSection(&cancelConnLock);
226
227 return TRUE;
228 }
229 else
230 /* Return FALSE for any signals not being handled */
231 return FALSE;
232}
233
234void
235setup_cancel_handler(void (*callback) (void))

Callers

nothing calls this directly

Calls 2

PQcancelFunction · 0.85
write_stderrFunction · 0.50

Tested by

no test coverage detected