1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Enable thread safety for win32.mak build of PostgreSQL.

Andreas Pflug
This commit is contained in:
Bruce Momjian
2004-06-19 04:22:17 +00:00
parent 1181ea6a78
commit af70d57825
5 changed files with 92 additions and 8 deletions

View File

@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.41 2004/06/03 00:13:19 momjian Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.42 2004/06/19 04:22:17 momjian Exp $
*
* NOTES
* The client *requires* a valid server certificate. Since
@@ -864,8 +864,14 @@ static int
init_ssl_system(PGconn *conn)
{
#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);
if (pq_initssllib && pq_lockarray == NULL) {
@@ -1171,6 +1177,7 @@ PQgetssl(PGconn *conn)
#ifdef ENABLE_THREAD_SAFETY
#ifndef WIN32
/*
* Check SIGPIPE handler and perhaps install our own.
*/
@@ -1211,6 +1218,7 @@ sigpipe_handler_ignore_send(int signo)
exit(128 + SIGPIPE); /* typical return value for SIG_DFL */
}
#endif
#endif
/*
* Indicates whether the current thread is in send()