summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/test/thread/alloc.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/alloc.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/alloc.pgc')
-rw-r--r--src/interfaces/ecpg/test/thread/alloc.pgc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/interfaces/ecpg/test/thread/alloc.pgc b/src/interfaces/ecpg/test/thread/alloc.pgc
index ea98495be4e..8e6d042d891 100644
--- a/src/interfaces/ecpg/test/thread/alloc.pgc
+++ b/src/interfaces/ecpg/test/thread/alloc.pgc
@@ -13,6 +13,7 @@ main(void)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <process.h>
+#include <locale.h>
#else
#include <pthread.h>
#endif
@@ -35,6 +36,10 @@ static void* fn(void* arg)
{
int i;
+#ifdef WIN32
+ _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
+#endif
+
EXEC SQL BEGIN DECLARE SECTION;
int value;
char name[100];