summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/test/thread/thread.pgc
diff options
context:
space:
mode:
authorMichael Meskes2017-08-26 10:57:21 +0000
committerMichael Meskes2017-08-26 10:57:21 +0000
commita772624b1d6b47ac00384901e1753f1d34b0cd10 (patch)
tree81d579aeb2d9b2579707c0f2b402b56f95b748b2 /src/interfaces/ecpg/test/thread/thread.pgc
parent449338cc644be6035d05afb6b60f536adfd99b3e (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 cc23b82484b..f08aacdee5f 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];