1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Add PQisthreadsafe() to libpq, to allow library applications to query

the thread-safety status of the library.
This commit is contained in:
Bruce Momjian
2006-05-23 22:13:19 +00:00
parent 7f52e0c50e
commit c1d4551ae1
4 changed files with 42 additions and 6 deletions

View File

@ -1,4 +1,4 @@
# $PostgreSQL: pgsql/src/interfaces/libpq/exports.txt,v 1.8 2006/05/21 20:19:23 tgl Exp $
# $PostgreSQL: pgsql/src/interfaces/libpq/exports.txt,v 1.9 2006/05/23 22:13:19 momjian Exp $
# Functions to be exported by libpq DLLs
PQconnectdb 1
PQsetdbLogin 2
@ -128,3 +128,5 @@ PQregisterThreadLock 125
PQescapeStringConn 126
PQescapeByteaConn 127
PQencryptPassword 128
PQisthreadsafe 129

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.183 2006/05/21 20:19:23 tgl Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.184 2006/05/23 22:13:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -2343,6 +2343,18 @@ PQisnonblocking(const PGconn *conn)
return pqIsnonblocking(conn);
}
/* libpq is thread-safe? */
int
PQisthreadsafe(void)
{
#ifdef ENABLE_THREAD_SAFETY
return true;
#else
return false;
#endif
}
/* try to force data out, really only useful for non-blocking users */
int
PQflush(PGconn *conn)

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.128 2006/05/21 20:19:23 tgl Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.129 2006/05/23 22:13:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -366,6 +366,7 @@ extern int PQendcopy(PGconn *conn);
/* Set blocking/nonblocking connection to the backend */
extern int PQsetnonblocking(PGconn *conn, int arg);
extern int PQisnonblocking(const PGconn *conn);
extern int PQisthreadsafe(void);
/* Force the write buffer to be written (or at least try) */
extern int PQflush(PGconn *conn);