Re: Compiling libpq with VisualC
| От | Andreas Pflug |
|---|---|
| Тема | Re: Compiling libpq with VisualC |
| Дата | |
| Msg-id | 40C97CEB.6030404@pse-consulting.de обсуждение исходный текст |
| Ответ на | Re: Compiling libpq with VisualC (Bruce Momjian <pgman@candle.pha.pa.us>) |
| Ответы |
Re: Compiling libpq with VisualC
|
| Список | pgsql-patches |
Bruce Momjian wrote:
>I have looked over this patch. I noticed this:
>
> -static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
> -
> + static pthread_mutex_t init_mutex;
> + static int mutex_initialized = 0;
> + if (!mutex_initialized)
> + {
> + mutex_initialized = 1;
> + pthread_mutex_init(&init_mutex, NULL);
> + }
>
>While this might work using your pthread compatibility implementation
>using CreateMutex(), it will not work on a native pthread implementation
>because you can only call pthread_mutex_init() once. Your code allows
>two threads to both call it.
>
>
I don't really think so. That mutex_initialized is a globally static
variable, not a thread local one. Thread interruption between testing
mutex_initialized and setting it is very unlikely and still wouldn't do
much harm if it actually does happen.
>Also, do you not have the problem with SIGPIPE from send(), so you don't
>need set/get_thread_specific()?
>
>
There's no SIGPIPE under win32, thus no problem.
Regards,
Andreas
В списке pgsql-patches по дате отправления: