File tree 2 files changed +10
-22
lines changed
2 files changed +10
-22
lines changed Original file line number Diff line number Diff line change 8
8
*
9
9
*
10
10
* 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 $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -3193,16 +3193,10 @@ default_threadlock(int acquire)
3193
3193
#ifndef WIN32
3194
3194
static pthread_mutex_t singlethread_lock = PTHREAD_MUTEX_INITIALIZER ;
3195
3195
#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 );
3206
3200
#endif
3207
3201
if (acquire )
3208
3202
pthread_mutex_lock (& singlethread_lock );
Original file line number Diff line number Diff line change 11
11
*
12
12
*
13
13
* 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 $
15
15
*
16
16
* NOTES
17
17
* The client *requires* a valid server certificate. Since
@@ -867,16 +867,10 @@ init_ssl_system(PGconn *conn)
867
867
#ifndef WIN32
868
868
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER ;
869
869
#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 );
880
874
#endif
881
875
pthread_mutex_lock (& init_mutex );
882
876
You can’t perform that action at this time.
0 commit comments