summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/test/thread/thread.pgc
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2017-08-26 12:57:21 +0200
committerMichael Meskes <meskes@postgresql.org>2017-09-14 01:17:03 +0200
commit839ee1811d053da4cdd0a44aea8fe7b011284be2 (patch)
treef39daa764fb960848af4668e2bef1d573453720c /src/interfaces/ecpg/test/thread/thread.pgc
parente5c8d43abde8cbb4b7fbbb5a215e497f11bf6fe6 (diff)
Make setlocale in ECPG test cases thread aware on Windows.
Fix threaded test cases on Windows not to crash in setlocale() which can be global or local to a thread on Windows. Author: Christian Ullrich
Diffstat (limited to 'src/interfaces/ecpg/test/thread/thread.pgc')
-rw-r--r--src/interfaces/ecpg/test/thread/thread.pgc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/interfaces/ecpg/test/thread/thread.pgc b/src/interfaces/ecpg/test/thread/thread.pgc
index d8ee96dd55a..05a23115d62 100644
--- a/src/interfaces/ecpg/test/thread/thread.pgc
+++ b/src/interfaces/ecpg/test/thread/thread.pgc
@@ -17,6 +17,7 @@ main(void)
#include <pthread.h>
#else
#include <windows.h>
+#include <locale.h>
#endif
exec sql include ../regression;
@@ -97,6 +98,11 @@ int main()
void *test_thread(void *arg)
{
long threadnum = (long)arg;
+
+#ifdef WIN32
+ _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
+#endif
+
EXEC SQL BEGIN DECLARE SECTION;
int l_i;
char l_connection[128];