pgsql: Fix ancient bug in ecpg's pthread_once() emulation for Windows.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix ancient bug in ecpg's pthread_once() emulation for Windows.
Дата
Msg-id E1kWN6k-0002Ng-AH@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix ancient bug in ecpg's pthread_once() emulation for Windows.

We must not set the "done" flag until after we've executed the
initialization function.  Otherwise, other threads can fall through
the initial unlocked test before initialization is really complete.

This has been seen to cause rare failures of ecpg's thread/descriptor
test, and it could presumably cause other sorts of misbehavior in
threaded ECPG-using applications, since ecpglib relies on
pthread_once() in several places.

Diagnosis and patch by me, based on investigation by Alexander Lakhin.
Back-patch to all supported branches (the bug dates to 2007).

Discussion: https://postgr.es/m/16685-d6cd241872c101d3@postgresql.org

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/bdc79ddd10790fcbaecc92e9ac3a64caa44d71e1

Modified Files
--------------
src/interfaces/ecpg/ecpglib/misc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)


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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: pgsql: Fix issue with --enable-coverage and the new unicode {de,re}comp
Следующее
От: David Rowley
Дата:
Сообщение: pgsql: Fix incorrect parameter name in a function header comment