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

Function PQgetCancel

src/interfaces/libpq/fe-connect.c:4516–4536  ·  view source on GitHub ↗

* PQgetCancel: get a PGcancel structure corresponding to a connection. * * A copy is needed to be able to cancel a running query from a different * thread. If the same structure is used all structure members would have * to be individually locked (if the entire structure was locked, it would * be impossible to cancel a synchronous query because the structure would * have to stay locked for t

Source from the content-addressed store, hash-verified

4514 * have to stay locked for the duration of the query).
4515 */
4516PGcancel *
4517PQgetCancel(PGconn *conn)
4518{
4519 PGcancel *cancel;
4520
4521 if (!conn)
4522 return NULL;
4523
4524 if (conn->sock == PGINVALID_SOCKET)
4525 return NULL;
4526
4527 cancel = malloc(sizeof(PGcancel));
4528 if (cancel == NULL)
4529 return NULL;
4530
4531 memcpy(&cancel->raddr, &conn->raddr, sizeof(SockAddr));
4532 cancel->be_pid = conn->be_pid;
4533 cancel->be_key = conn->be_key;
4534
4535 return cancel;
4536}
4537
4538/* PQfreeCancel: free a cancel structure */
4539void

Callers 8

pgfdw_cancel_queryFunction · 0.85
dblink_cancel_queryFunction · 0.85
cdbconn_signalQEFunction · 0.85
disconnectDatabaseFunction · 0.85
SetCancelConnFunction · 0.85
try_complete_stepFunction · 0.85
set_archive_cancel_infoFunction · 0.85
main.cFile · 0.85

Calls

no outgoing calls

Tested by 1

try_complete_stepFunction · 0.68