Re: libpq Win32 Mutex performance patch

Поиск
Список
Период
Сортировка
От Magnus Hagander
Тема Re: libpq Win32 Mutex performance patch
Дата
Msg-id 20080411204934.10bad97b@mha-laptop
обсуждение исходный текст
Ответ на libpq Win32 Mutex performance patch  (Andrew Chernow <ac@esilo.com>)
Ответы Re: libpq Win32 Mutex performance patch  (Andrew Chernow <ac@esilo.com>)
Re: libpq Win32 Mutex performance patch  ("Merlin Moncure" <mmoncure@gmail.com>)
Список pgsql-patches
Andrew Chernow wrote:
> I noticed several months ago, and came across it again today, that
> libpq's pthread-win32.c implementation is using CreateMutex rather
> than CRITICAL_SECTION.  CreateMutex is like a semaphore in that it is
> designed to be accessible via name system-wide.  Even when you don't
> give it a name, thus bound to process that created it, it still
> carries significant overhead compared to using win32
> CRITICAL_SECTIONs.
>
> The attached patch replaces the win32 mutex calls with critical
> section calls.  The change will not affect the behavior of the
> windows pthread_xxx functions.

First of all, I like this in general :-) But a couple of comments.

It changes the behavior when the pointer passed in is invalid from
crash to silent working, right? This shouldn't actually matter,
since these functions are only ever supposed to run from callers
*inside libpq*, so it probalby doesn't matter...

Which brings up the second point - is there any actual reason for
adding the pthread_mutex_destroy call? Since libpq never calls it, and
it's never used from outside libpq (it's not exported outside the
library even), isn't it just going to end up as dead code?

//Magnus

В списке pgsql-patches по дате отправления:

Предыдущее
От: Andrew Chernow
Дата:
Сообщение: libpq Win32 Mutex performance patch
Следующее
От: Andrew Chernow
Дата:
Сообщение: Re: libpq Win32 Mutex performance patch