postgres/src/interfaces
Tom Lane 379c43bdad 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
2020-10-24 13:12:47 -04:00
..
ecpg Fix ancient bug in ecpg's pthread_once() emulation for Windows. 2020-10-24 13:12:47 -04:00
libpq In libpq for Windows, call WSAStartup once and WSACleanup not at all. 2020-10-19 11:23:52 -04:00
Makefile Fix parallel make when running make install before make all 2011-03-08 23:52:29 +02:00