31 #define write_stderr(str) \
33 const char *str_ = (str); \
35 rc_ = write(fileno(stderr), str_, strlen(str_)); \
62 static CRITICAL_SECTION cancelConnLock;
82 EnterCriticalSection(&cancelConnLock);
91 if (oldCancelConn != NULL)
97 LeaveCriticalSection(&cancelConnLock);
112 EnterCriticalSection(&cancelConnLock);
120 if (oldCancelConn != NULL)
124 LeaveCriticalSection(&cancelConnLock);
195 consoleHandler(DWORD dwCtrlType)
199 if (dwCtrlType == CTRL_C_EVENT ||
200 dwCtrlType == CTRL_BREAK_EVENT)
208 EnterCriticalSection(&cancelConnLock);
222 LeaveCriticalSection(&cancelConnLock);
238 InitializeCriticalSection(&cancelConnLock);
240 SetConsoleCtrlHandler(consoleHandler, TRUE);
volatile sig_atomic_t CancelRequested
static void(* cancel_callback)(void)
void ResetCancelConn(void)
static const char * cancel_sent_msg
void SetCancelConn(PGconn *conn)
static PGcancel *volatile cancelConn
#define write_stderr(str)
static const char * cancel_not_sent_msg
void setup_cancel_handler(void(*query_cancel_callback)(void))
static void handle_sigint(SIGNAL_ARGS)
PGcancel * PQgetCancel(PGconn *conn)
int PQcancel(PGcancel *cancel, char *errbuf, int errbufsize)
void PQfreeCancel(PGcancel *cancel)
pqsigfunc pqsignal(int signo, pqsigfunc func)
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)