Re: [PATCHES] Compiling libpq with VisualC

Manfred Spraul <[email protected]>
Newsgroups gmane.comp.db.postgresql.devel.general,gmane.comp.db.postgresql.devel.win32
Message-ID <[email protected]>
[email protected] 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

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.