Re: [PATCHES] Compiling libpq with VisualC - Mailing list pgsql-hackers

From Manfred Spraul
Subject Re: [PATCHES] Compiling libpq with VisualC
Date
Msg-id 40CD3875.3070005@colorfullife.com
Whole thread Raw
In response to Re: [PATCHES] Compiling libpq with VisualC  (pgsql@mohawksoft.com)
List pgsql-hackers
pgsql@mohawksoft.com wrote:

>>
>>What is the recommended way to create mutex objects (CreateMutex) from
>>Win32 libraries?  There must be a clean way like there is in pthreads.
>>
>>
>
>A mutex is inherently a global object. CreateMutex(NULL, FALSE, NULL) will
>return a handle to an unowned mutex.
>
>
>
That's not the problem. Under pthread, it's possible to initialize a
mutex from compile time:

    static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;

This means that the mutex is immediately valid, no races with the
initialization. I couldn't find an equivalent Win32 feature.

--
    Manfred

pgsql-hackers by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: I just got it: PostgreSQL Application Server -- a
Next
From: Heikki Linnakangas
Date:
Subject: Re: File leak?