summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/test/thread/thread_implicit.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_implicit.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_implicit.pgc')
-rw-r--r--src/interfaces/ecpg/test/thread/thread_implicit.pgc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/interfaces/ecpg/test/thread/thread_implicit.pgc b/src/interfaces/ecpg/test/thread/thread_implicit.pgc
index e39b8b80077..f4d7a881401 100644
--- a/src/interfaces/ecpg/test/thread/thread_implicit.pgc
+++ b/src/interfaces/ecpg/test/thread/thread_implicit.pgc
@@ -18,6 +18,7 @@ main(void)
#include <pthread.h>
#else
#include <windows.h>
+#include <locale.h>
#endif
exec sql include ../regression;
@@ -98,6 +99,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];