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
af70d578
Commit
af70d578
authored
Jun 19, 2004
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable thread safety for win32.mak build of PostgreSQL.
Andreas Pflug
parent
1181ea6a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
92 additions
and
8 deletions
+92
-8
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-connect.c
+11
-1
src/interfaces/libpq/fe-secure.c
src/interfaces/libpq/fe-secure.c
+11
-3
src/interfaces/libpq/pthread-win32.c
src/interfaces/libpq/pthread-win32.c
+44
-0
src/interfaces/libpq/pthread.h.win32
src/interfaces/libpq/pthread.h.win32
+17
-0
src/interfaces/libpq/win32.mak
src/interfaces/libpq/win32.mak
+9
-4
No files found.
src/interfaces/libpq/fe-connect.c
View file @
af70d578
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.27
4 2004/06/10 22:26:24
momjian Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.27
5 2004/06/19 04:22:17
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -882,10 +882,12 @@ connectDBStart(PGconn *conn)
...
@@ -882,10 +882,12 @@ connectDBStart(PGconn *conn)
const
char
*
node
=
NULL
;
const
char
*
node
=
NULL
;
int
ret
;
int
ret
;
#ifdef ENABLE_THREAD_SAFETY
#ifdef ENABLE_THREAD_SAFETY
#ifndef WIN32
static
pthread_once_t
check_sigpipe_once
=
PTHREAD_ONCE_INIT
;
static
pthread_once_t
check_sigpipe_once
=
PTHREAD_ONCE_INIT
;
/* Check only on first connection request */
/* Check only on first connection request */
pthread_once
(
&
check_sigpipe_once
,
check_sigpipe_handler
);
pthread_once
(
&
check_sigpipe_once
,
check_sigpipe_handler
);
#endif
#endif
#endif
if
(
!
conn
)
if
(
!
conn
)
...
@@ -3183,11 +3185,19 @@ PQinitSSL(int do_init)
...
@@ -3183,11 +3185,19 @@ PQinitSSL(int do_init)
}
}
static
pgthreadlock_t
default_threadlock
;
static
pgthreadlock_t
default_threadlock
;
static
void
static
void
default_threadlock
(
int
acquire
)
default_threadlock
(
int
acquire
)
{
{
#ifdef ENABLE_THREAD_SAFETY
#ifdef ENABLE_THREAD_SAFETY
#ifndef WIN32
static
pthread_mutex_t
singlethread_lock
=
PTHREAD_MUTEX_INITIALIZER
;
static
pthread_mutex_t
singlethread_lock
=
PTHREAD_MUTEX_INITIALIZER
;
#else
static
pthread_mutex_t
singlethread_lock
;
static
long
mutex_initialized
=
0
;
if
(
!
InterlockedExchange
(
&
mutex_initialized
,
1L
))
pthread_mutex_init
(
&
singlethread_lock
,
NULL
);
#endif
if
(
acquire
)
if
(
acquire
)
pthread_mutex_lock
(
&
singlethread_lock
);
pthread_mutex_lock
(
&
singlethread_lock
);
else
else
...
...
src/interfaces/libpq/fe-secure.c
View file @
af70d578
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.4
1 2004/06/03 00:13:19
momjian Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.4
2 2004/06/19 04:22:17
momjian Exp $
*
*
* NOTES
* NOTES
* The client *requires* a valid server certificate. Since
* The client *requires* a valid server certificate. Since
...
@@ -864,8 +864,14 @@ static int
...
@@ -864,8 +864,14 @@ static int
init_ssl_system
(
PGconn
*
conn
)
init_ssl_system
(
PGconn
*
conn
)
{
{
#ifdef ENABLE_THREAD_SAFETY
#ifdef ENABLE_THREAD_SAFETY
static
pthread_mutex_t
init_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
#ifndef WIN32
static
pthread_mutex_t
init_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
#else
static
pthread_mutex_t
init_mutex
;
static
long
mutex_initialized
=
0L
;
if
(
!
InterlockedExchange
(
&
mutex_initialized
,
1L
))
pthread_mutex_init
(
&
init_mutex
,
NULL
);
#endif
pthread_mutex_lock
(
&
init_mutex
);
pthread_mutex_lock
(
&
init_mutex
);
if
(
pq_initssllib
&&
pq_lockarray
==
NULL
)
{
if
(
pq_initssllib
&&
pq_lockarray
==
NULL
)
{
...
@@ -1171,6 +1177,7 @@ PQgetssl(PGconn *conn)
...
@@ -1171,6 +1177,7 @@ PQgetssl(PGconn *conn)
#ifdef ENABLE_THREAD_SAFETY
#ifdef ENABLE_THREAD_SAFETY
#ifndef WIN32
/*
/*
* Check SIGPIPE handler and perhaps install our own.
* Check SIGPIPE handler and perhaps install our own.
*/
*/
...
@@ -1211,6 +1218,7 @@ sigpipe_handler_ignore_send(int signo)
...
@@ -1211,6 +1218,7 @@ sigpipe_handler_ignore_send(int signo)
exit
(
128
+
SIGPIPE
);
/* typical return value for SIG_DFL */
exit
(
128
+
SIGPIPE
);
/* typical return value for SIG_DFL */
}
}
#endif
#endif
#endif
/*
/*
* Indicates whether the current thread is in send()
* Indicates whether the current thread is in send()
...
...
src/interfaces/libpq/pthread-win32.c
0 → 100644
View file @
af70d578
/*-------------------------------------------------------------------------
*
* pthread-win32.c
* partial pthread implementation for win32
*
* Copyright (c) 2004, PostgreSQL Global Development Group
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/pthread-win32.c,v 1.1 2004/06/19 04:22:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "windows.h"
#include "pthread.h"
HANDLE
pthread_self
()
{
return
GetCurrentThread
();
}
void
pthread_setspecific
(
pthread_key_t
key
,
void
*
val
)
{
}
void
*
pthread_getspecific
(
pthread_key_t
key
)
{
return
NULL
;
}
void
pthread_mutex_init
(
pthread_mutex_t
*
mp
,
void
*
attr
)
{
*
mp
=
CreateMutex
(
0
,
0
,
0
);
}
void
pthread_mutex_lock
(
pthread_mutex_t
*
mp
)
{
WaitForSingleObject
(
*
mp
,
INFINITE
);
}
void
pthread_mutex_unlock
(
pthread_mutex_t
*
mp
)
{
ReleaseMutex
(
*
mp
);
}
src/interfaces/libpq/pthread.h.win32
0 → 100644
View file @
af70d578
#ifndef __PTHREAD_H
#define __PTHREAD_H
typedef ULONG pthread_key_t;
typedef HANDLE pthread_mutex_t;
typedef int pthread_once_t;
HANDLE pthread_self();
void pthread_setspecific(pthread_key_t, void*);
void* pthread_getspecific(pthread_key_t);
void pthread_mutex_init(pthread_mutex_t *, void *attr);
void pthread_mutex_lock(pthread_mutex_t*); // blocking
void pthread_mutex_unlock(pthread_mutex_t*);
#endif
src/interfaces/libpq/win32.mak
View file @
af70d578
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
# and a Win32 dynamic library libpq(d).dll with import library libpq(d)dll.lib
# and a Win32 dynamic library libpq(d).dll with import library libpq(d)dll.lib
# USE_SSL=1 will compile with OpenSSL
# USE_SSL=1 will compile with OpenSSL
# DEBUG=1 compiles with debugging symbols
# DEBUG=1 compiles with debugging symbols
# ENABLE_THREAD_SAFETY=1 compiles with threading enabled
!MESSAGE
Building
the
Win32
static
library...
!MESSAGE
Building
the
Win32
static
library...
!MESSAGE
!MESSAGE
...
@@ -74,21 +74,25 @@ CLEAN :
...
@@ -74,21 +74,25 @@ CLEAN :
-
@erase
"
$(OUTDIR)
\$
(OUTFILENAME)dll.lib"
-
@erase
"
$(OUTDIR)
\$
(OUTFILENAME)dll.lib"
-
@erase
"
$(INTDIR)
\w
char.obj"
-
@erase
"
$(INTDIR)
\w
char.obj"
-
@erase
"
$(INTDIR)
\e
ncnames.obj"
-
@erase
"
$(INTDIR)
\e
ncnames.obj"
-
@erase
"
$(INTDIR)
\p
thread-win32.obj"
config
:
..
\.
.
\i
nclude
\p
g_config.h pg_config_paths.h
config
:
..
\.
.
\i
nclude
\p
g_config.h p
thread.h p
g_config_paths.h
..\..\include\pg_config.h
:
..
\.
.
\i
nclude
\p
g_config.h.win32
..\..\include\pg_config.h
:
..
\.
.
\i
nclude
\p
g_config.h.win32
copy ..
\.
.
\i
nclude
\p
g_config.h.win32 ..
\.
.
\i
nclude
\p
g_config.h
copy ..
\.
.
\i
nclude
\p
g_config.h.win32 ..
\.
.
\i
nclude
\p
g_config.h
pthread.h
:
pthread.h.win32
copy pthread.h.win32 pthread.h
pg_config_paths.h
:
win32.mak
pg_config_paths.h
:
win32.mak
echo
#define SYSCONFDIR "" >pg_config_paths.h
echo
#define SYSCONFDIR "" >pg_config_paths.h
"$(OUTDIR)"
:
"$(OUTDIR)"
:
if
not
exist
"$(OUTDIR)/$(NULL)"
mkdir
"$(OUTDIR)"
if
not
exist
"$(OUTDIR)/$(NULL)"
mkdir
"$(OUTDIR)"
CPP_PROJ
=
/nologo /W3 /GX
$(OPT)
/I
"..
\.
.
\i
nclude"
/D
"FRONTEND"
$(DEBUGDEF)
/D
\
CPP_PROJ
=
/nologo /W3 /GX
$(OPT)
/I
"..
\.
.
\i
nclude"
/
I. /
D
"FRONTEND"
$(DEBUGDEF)
/D
\
"WIN32"
/D
"_WINDOWS"
/Fp
"
$(INTDIR)
\l
ibpq.pch"
/YX
\
"WIN32"
/D
"_WINDOWS"
/Fp
"
$(INTDIR)
\l
ibpq.pch"
/YX
\
/Fo
"
$(INTDIR)
\\
"
/Fd
"
$(INTDIR)
\\
"
/FD /c /D
"HAVE_VSNPRINTF"
/D
"HAVE_STRDUP"
/Fo
"
$(INTDIR)
\\
"
/Fd
"
$(INTDIR)
\\
"
/FD /c /D
"HAVE_VSNPRINTF"
/D
"HAVE_STRDUP"
...
@@ -127,7 +131,8 @@ LIB32_OBJS= \
...
@@ -127,7 +131,8 @@ LIB32_OBJS= \
"
$(INTDIR)
\f
e-secure.obj"
\
"
$(INTDIR)
\f
e-secure.obj"
\
"
$(INTDIR)
\p
qexpbuffer.obj"
\
"
$(INTDIR)
\p
qexpbuffer.obj"
\
"
$(INTDIR)
\w
char.obj"
\
"
$(INTDIR)
\w
char.obj"
\
"
$(INTDIR)
\e
ncnames.obj"
"
$(INTDIR)
\e
ncnames.obj"
\
"
$(INTDIR)
\p
thread-win32.obj"
RSC_PROJ
=
/l 0x409 /fo
"
$(INTDIR)
\l
ibpq.res"
RSC_PROJ
=
/l 0x409 /fo
"
$(INTDIR)
\l
ibpq.res"
...
...
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