[PATCH] fix libpq mutex initialization for multithreaded win32 libs

From: Manfred Spraul <manfred(at)colorfullife(dot)com>
To: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: [PATCH] fix libpq mutex initialization for multithreaded win32 libs
Date: 2004-06-30 17:24:22
Message-ID: 40E2F746.3020801@colorfullife.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Hi,

win32 doesn't support a static initializer for mutexes, thus the first
user must initialize the lock. The problem are concurrent "first" users
- the pthread_mutex_t initialization must be synchronized.
The current implementation is broken, the attached patches fixes that:
mutex_initlock is a spinlock. If the pthread_mutex_t mutex is not
initialized, then the spinlock is acquired, if the pthread_mutex_t is
initialized if it's not yet initialized and then the spinlock is dropped.

Again untested due to lack of Visual C++.

--
Manfre

Attachment Content-Type Size
patch-win32-lock text/plain 2.7 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Kris Jurka 2004-06-30 17:46:54 Re: psql schema permissions
Previous Message Manfred Spraul 2004-06-30 17:19:10 [PATCH] s_lock support for win32