diff options
| author | Bruce Momjian <bruce@momjian.us> | 2004-06-19 04:22:17 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2004-06-19 04:22:17 +0000 |
| commit | af70d578257735b8a2c44771969e04f8cb2eb217 (patch) | |
| tree | 673c9ac80d489b77ee834fcf841ca020a19cebf1 /src/interfaces/libpq/fe-secure.c | |
| parent | 1181ea6a78dabc1c1c126dc8e0f64057b1b26e82 (diff) | |
| download | postgresql-af70d578257735b8a2c44771969e04f8cb2eb217.tar.gz | |
Enable thread safety for win32.mak build of PostgreSQL.
Andreas Pflug
Diffstat (limited to 'src/interfaces/libpq/fe-secure.c')
| -rw-r--r-- | src/interfaces/libpq/fe-secure.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c index 673c6aad4d..c827f940e2 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.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() |
