File tree 4 files changed +42
-6
lines changed
4 files changed +42
-6
lines changed Original file line number Diff line number Diff line change 1
- <!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.210 2006/05/21 20:19:23 tgl Exp $ -->
1
+ <!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.211 2006/05/23 22:13:19 momjian Exp $ -->
2
2
3
3
<chapter id="libpq">
4
4
<title><application>libpq</application> - C Library</title>
@@ -4196,11 +4196,32 @@ options when you compile your application code. Refer to your
4196
4196
system's documentation for information about how to build
4197
4197
thread-enabled applications, or look in
4198
4198
<filename>src/Makefile.global</filename> for <literal>PTHREAD_CFLAGS</>
4199
- and <literal>PTHREAD_LIBS</>.
4199
+ and <literal>PTHREAD_LIBS</>. This function allows the querying of
4200
+ <application>libpq</application>'s thread-safe status:
4200
4201
</para>
4201
4202
4203
+ <variablelist>
4204
+ <varlistentry>
4205
+ <term><function>PQisthreadsafe</function><indexterm><primary>PQisthreadsafe</></></term>
4206
+ <listitem>
4207
+ <para>
4208
+ Returns the thread safety status of the <application>libpq</application>
4209
+ library.
4210
+ <synopsis>
4211
+ int PQisthreadsafe();
4212
+ </synopsis>
4213
+ </para>
4214
+
4215
+ <para>
4216
+ Returns 1 if the <application>libpq</application> is thead-safe and
4217
+ 0 if it is not.
4218
+ </para>
4219
+ </listitem>
4220
+ </varlistentry>
4221
+ </variablelist>
4222
+
4202
4223
<para>
4203
- One restriction is that no two threads attempt to manipulate the same
4224
+ One thread restriction is that no two threads attempt to manipulate the same
4204
4225
<structname>PGconn</> object at the same time. In particular, you cannot
4205
4226
issue concurrent commands from different threads through the same
4206
4227
connection object. (If you need to run concurrent commands, use
Original file line number Diff line number Diff line change 1
- # $PostgreSQL: pgsql/src/interfaces/libpq/exports.txt,v 1.8 2006/05/21 20:19:23 tgl Exp $
1
+ # $PostgreSQL: pgsql/src/interfaces/libpq/exports.txt,v 1.9 2006/05/23 22:13:19 momjian Exp $
2
2
# Functions to be exported by libpq DLLs
3
3
PQconnectdb 1
4
4
PQsetdbLogin 2
@@ -128,3 +128,5 @@ PQregisterThreadLock 125
128
128
PQescapeStringConn 126
129
129
PQescapeByteaConn 127
130
130
PQencryptPassword 128
131
+ PQisthreadsafe 129
132
+
Original file line number Diff line number Diff line change 8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.183 2006/05/21 20:19:23 tgl Exp $
11
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.184 2006/05/23 22:13:19 momjian Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -2343,6 +2343,18 @@ PQisnonblocking(const PGconn *conn)
2343
2343
return pqIsnonblocking (conn );
2344
2344
}
2345
2345
2346
+ /* libpq is thread-safe? */
2347
+ int
2348
+ PQisthreadsafe (void )
2349
+ {
2350
+ #ifdef ENABLE_THREAD_SAFETY
2351
+ return true;
2352
+ #else
2353
+ return false;
2354
+ #endif
2355
+ }
2356
+
2357
+
2346
2358
/* try to force data out, really only useful for non-blocking users */
2347
2359
int
2348
2360
PQflush (PGconn * conn )
Original file line number Diff line number Diff line change 7
7
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
8
8
* Portions Copyright (c) 1994, Regents of the University of California
9
9
*
10
- * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.128 2006/05/21 20:19:23 tgl Exp $
10
+ * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.129 2006/05/23 22:13:19 momjian Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -366,6 +366,7 @@ extern int PQendcopy(PGconn *conn);
366
366
/* Set blocking/nonblocking connection to the backend */
367
367
extern int PQsetnonblocking (PGconn * conn , int arg );
368
368
extern int PQisnonblocking (const PGconn * conn );
369
+ extern int PQisthreadsafe (void );
369
370
370
371
/* Force the write buffer to be written (or at least try) */
371
372
extern int PQflush (PGconn * conn );
You can’t perform that action at this time.
0 commit comments