aboutsummaryrefslogtreecommitdiff
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-08-26 12:57:21 +0200
commita772624b1d6b47ac00384901e1753f1d34b0cd10 (patch)
tree81d579aeb2d9b2579707c0f2b402b56f95b748b2 /src/interfaces/ecpg/test/thread/alloc.pgc
parent449338cc644be6035d05afb6b60f536adfd99b3e (diff)
downloadpostgresql-a772624b1d6b47ac00384901e1753f1d34b0cd10.tar.gz
postgresql-a772624b1d6b47ac00384901e1753f1d34b0cd10.zip
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];