Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbdc79dd

Browse files
committed
Fix ancient bug in ecpg's pthread_once() emulation for Windows.
We must not set the "done" flag until after we've executed theinitialization function. Otherwise, other threads can fall throughthe initial unlocked test before initialization is really complete.This has been seen to cause rare failures of ecpg's thread/descriptortest, and it could presumably cause other sorts of misbehavior inthreaded ECPG-using applications, since ecpglib relies onpthread_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
1 parent78ccf7f commitbdc79dd

File tree

1 file changed

+1
-1
lines changed
  • src/interfaces/ecpg/ecpglib

1 file changed

+1
-1
lines changed

‎src/interfaces/ecpg/ecpglib/misc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,8 @@ win32_pthread_once(volatile pthread_once_t *once, void (*fn) (void))
482482
pthread_mutex_lock(&win32_pthread_once_lock);
483483
if (!*once)
484484
{
485-
*once= true;
486485
fn();
486+
*once= true;
487487
}
488488
pthread_mutex_unlock(&win32_pthread_once_lock);
489489
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp