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