Skip to content

Commit a29d26a

Browse files
committed
Back out thread fix until I get clarification.
1 parent a41463e commit a29d26a

File tree

2 files changed

+10
-22
lines changed

2 files changed

+10
-22
lines changed

src/interfaces/libpq/fe-connect.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.276 2004/07/12 14:11:17 momjian Exp $
11+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.277 2004/07/12 14:16:28 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -3193,16 +3193,10 @@ default_threadlock(int acquire)
31933193
#ifndef WIN32
31943194
static pthread_mutex_t singlethread_lock = PTHREAD_MUTEX_INITIALIZER;
31953195
#else
3196-
static pthread_mutex_t singlethread_lock = NULL;
3197-
static long mutex_initlock = 0;
3198-
3199-
if (singlethread_lock == NULL) {
3200-
while(InterlockedExchange(&mutex_initlock, 1) == 1)
3201-
/* loop, another thread own the lock */ ;
3202-
if (singlethread_lock == NULL)
3203-
pthread_mutex_init(&singlethread_lock, NULL);
3204-
InterlockedExchange(&mutex_initlock,0);
3205-
}
3196+
static pthread_mutex_t singlethread_lock;
3197+
static long mutex_initialized = 0;
3198+
if (!InterlockedExchange(&mutex_initialized, 1L))
3199+
pthread_mutex_init(&singlethread_lock, NULL);
32063200
#endif
32073201
if (acquire)
32083202
pthread_mutex_lock(&singlethread_lock);

src/interfaces/libpq/fe-secure.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.43 2004/07/12 14:11:17 momjian Exp $
14+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.44 2004/07/12 14:16:28 momjian Exp $
1515
*
1616
* NOTES
1717
* The client *requires* a valid server certificate. Since
@@ -867,16 +867,10 @@ init_ssl_system(PGconn *conn)
867867
#ifndef WIN32
868868
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
869869
#else
870-
static pthread_mutex_t init_mutex = NULL;
871-
static long mutex_initlock = 0;
872-
873-
if (init_mutex == NULL) {
874-
while(InterlockedExchange(&mutex_initlock, 1) == 1)
875-
/* loop, another thread own the lock */ ;
876-
if (init_mutex == NULL)
877-
pthread_mutex_init(&init_mutex, NULL);
878-
InterlockedExchange(&mutex_initlock,0);
879-
}
870+
static pthread_mutex_t init_mutex;
871+
static long mutex_initialized = 0L;
872+
if (!InterlockedExchange(&mutex_initialized, 1L))
873+
pthread_mutex_init(&init_mutex, NULL);
880874
#endif
881875
pthread_mutex_lock(&init_mutex);
882876

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy