Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
c1d4551a
Commit
c1d4551a
authored
May 23, 2006
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add PQisthreadsafe() to libpq, to allow library applications to query
the thread-safety status of the library.
parent
7f52e0c5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
6 deletions
+42
-6
doc/src/sgml/libpq.sgml
doc/src/sgml/libpq.sgml
+24
-3
src/interfaces/libpq/exports.txt
src/interfaces/libpq/exports.txt
+3
-1
src/interfaces/libpq/fe-exec.c
src/interfaces/libpq/fe-exec.c
+13
-1
src/interfaces/libpq/libpq-fe.h
src/interfaces/libpq/libpq-fe.h
+2
-1
No files found.
doc/src/sgml/libpq.sgml
View file @
c1d4551a
<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.21
0 2006/05/21 20:19:23 tgl
Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.21
1 2006/05/23 22:13:19 momjian
Exp $ -->
<chapter id="libpq">
<title><application>libpq</application> - C Library</title>
...
...
@@ -4196,11 +4196,32 @@ options when you compile your application code. Refer to your
system's documentation for information about how to build
thread-enabled applications, or look in
<filename>src/Makefile.global</filename> for <literal>PTHREAD_CFLAGS</>
and <literal>PTHREAD_LIBS</>.
and <literal>PTHREAD_LIBS</>. This function allows the querying of
<application>libpq</application>'s thread-safe status:
</para>
<variablelist>
<varlistentry>
<term><function>PQisthreadsafe</function><indexterm><primary>PQisthreadsafe</></></term>
<listitem>
<para>
Returns the thread safety status of the <application>libpq</application>
library.
<synopsis>
int PQisthreadsafe();
</synopsis>
</para>
<para>
Returns 1 if the <application>libpq</application> is thead-safe and
0 if it is not.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
One restriction is that no two threads attempt to manipulate the same
One
thread
restriction is that no two threads attempt to manipulate the same
<structname>PGconn</> object at the same time. In particular, you cannot
issue concurrent commands from different threads through the same
connection object. (If you need to run concurrent commands, use
...
...
src/interfaces/libpq/exports.txt
View file @
c1d4551a
# $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
src/interfaces/libpq/fe-exec.c
View file @
c1d4551a
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.18
3 2006/05/21 20:19:23 tgl
Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.18
4 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
)
...
...
src/interfaces/libpq/libpq-fe.h
View file @
c1d4551a
...
...
@@ -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.12
8 2006/05/21 20:19:23 tgl
Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.12
9 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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment