/* * pgWaitTimeout: wait, but not past finish_time. * wrapper for pqSocketCheck. * * finish_time = ((time_t) -1) disables the wait limit. */ int pqWaitTimeout(int forRead, int forWrite, PGconn *conn, time_t finish_time) { int result; result = pqSocketCheck(conn, forRead, forWrite, finish_time); if (result == 0) { printfPQExpBuffer(&conn->errorMessage, libpq_gettext("timeout expired\n")); } return result; }
/* * pqWaitTimed: wait, but not past finish_time. * * finish_time = ((time_t) -1) disables the wait limit. * * Returns -1 on failure, 0 if the socket is readable/writable, 1 if it timed out. */ int pqWaitTimed(int forRead, int forWrite, PGconn *conn, time_t finish_time) { int result; result = pqSocketCheck(conn, forRead, forWrite, finish_time); if (result < 0) return -1; /* errorMessage is already set */ if (result == 0) { printfPQExpBuffer(&conn->errorMessage, libpq_gettext("timeout expired\n")); return 1; } return 0; }
/* * pqWriteReady: is select() saying the file is ready to write? * Returns -1 on failure, 0 if not ready, 1 if ready. */ int pqWriteReady(PGconn *conn) { return pqSocketCheck(conn, 0, 1, (time_t) 0); }
/* * pqReadReady: is select() saying the file is ready to read? * Returns -1 on failure, 0 if not ready, 1 if ready. */ int pqReadReady(PGconn *conn) { return pqSocketCheck(conn, 1, 0, (time_t) 0); }