diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2019-01-21 16:17:10 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2019-01-21 16:17:10 -0500 |
commit | ee27584c4a40620fb26d1729e9cc449d54d62b07 (patch) | |
tree | e841f04f0e7ca473503f6dc52b1bf53a3c8c2f4b /src/interfaces/ecpg/ecpglib/execute.c | |
parent | 527114e51e45dbd91d46171fa4a111355f0dfc3b (diff) | |
download | postgresql-ee27584c4a40620fb26d1729e9cc449d54d62b07.tar.gz postgresql-ee27584c4a40620fb26d1729e9cc449d54d62b07.zip |
Second try at fixing ecpglib thread-safety problem.
While Windows (allegedly) has _configthreadlocale() pretty far back,
it seems MinGW didn't acquire support for that till more recently.
Fortunately, we can use an autoconf probe on that toolchain,
instead of guessing whether it's there. (Hm, I wonder whether Cygwin
will need this also.)
Per buildfarm.
Discussion: https://postgr.es/m/20190121193512.tdmcnic2yjxlufaw@alap3.anarazel.de
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/execute.c')
-rw-r--r-- | src/interfaces/ecpg/ecpglib/execute.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c index 81aaf10f088..a9f945e6188 100644 --- a/src/interfaces/ecpg/ecpglib/execute.c +++ b/src/interfaces/ecpg/ecpglib/execute.c @@ -1778,7 +1778,7 @@ ecpg_do_prologue(int lineno, const int compat, const int force_indicator, * Make sure we do NOT honor the locale for numeric input/output since the * database wants the standard decimal point. If available, use * uselocale() for this because it's thread-safe. Windows doesn't have - * that, but it does have _configthreadlocale(). + * that, but it usually does have _configthreadlocale(). */ #ifdef HAVE_USELOCALE stmt->clocale = newlocale(LC_NUMERIC_MASK, "C", (locale_t) 0); @@ -1794,7 +1794,7 @@ ecpg_do_prologue(int lineno, const int compat, const int force_indicator, return false; } #else -#ifdef WIN32 +#ifdef HAVE__CONFIGTHREADLOCALE stmt->oldthreadlocale = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE); if (stmt->oldthreadlocale == -1) { @@ -2019,7 +2019,7 @@ ecpg_do_epilogue(struct statement *stmt) if (stmt->oldlocale) { setlocale(LC_NUMERIC, stmt->oldlocale); -#ifdef WIN32 +#ifdef HAVE__CONFIGTHREADLOCALE _configthreadlocale(stmt->oldthreadlocale); #endif } |