aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-secure.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2004-07-12 14:16:28 +0000
committerBruce Momjian <bruce@momjian.us>2004-07-12 14:16:28 +0000
commita29d26a3cdf8c61313ae459366eeb05f67772cc0 (patch)
tree4521c560b42530e19dd1b3eb1fb3576fdfab33c4 /src/interfaces/libpq/fe-secure.c
parenta41463e31c4e3c231a84c47088e76d39191c4f36 (diff)
downloadpostgresql-a29d26a3cdf8c61313ae459366eeb05f67772cc0.tar.gz
postgresql-a29d26a3cdf8c61313ae459366eeb05f67772cc0.zip
Back out thread fix until I get clarification.
Diffstat (limited to 'src/interfaces/libpq/fe-secure.c')
-rw-r--r--src/interfaces/libpq/fe-secure.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c
index ad7897ff7f4..a60f34875d9 100644
--- a/src/interfaces/libpq/fe-secure.c
+++ b/src/interfaces/libpq/fe-secure.c
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.43 2004/07/12 14:11:17 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.44 2004/07/12 14:16:28 momjian Exp $
*
* NOTES
* The client *requires* a valid server certificate. Since
@@ -867,16 +867,10 @@ init_ssl_system(PGconn *conn)
#ifndef WIN32
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
#else
- static pthread_mutex_t init_mutex = NULL;
- static long mutex_initlock = 0;
-
- if (init_mutex == NULL) {
- while(InterlockedExchange(&mutex_initlock, 1) == 1)
- /* loop, another thread own the lock */ ;
- if (init_mutex == NULL)
- pthread_mutex_init(&init_mutex, NULL);
- InterlockedExchange(&mutex_initlock,0);
- }
+ 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);