mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-24 18:55:04 +08:00
Made new test also work without threading enabled.
This commit is contained in:
parent
b5efdbac5c
commit
5a0d31d3dc
@ -8,6 +8,7 @@
|
|||||||
#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
|
#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
|
||||||
|
|
||||||
#line 1 "descriptor.pgc"
|
#line 1 "descriptor.pgc"
|
||||||
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -15,6 +16,7 @@
|
|||||||
#else
|
#else
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define THREADS 16
|
#define THREADS 16
|
||||||
@ -89,19 +91,19 @@ struct sqlca_t *ECPGget_sqlca(void);
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#line 13 "descriptor.pgc"
|
#line 15 "descriptor.pgc"
|
||||||
|
|
||||||
/* exec sql whenever sqlerror sqlprint ; */
|
/* exec sql whenever sqlerror sqlprint ; */
|
||||||
#line 14 "descriptor.pgc"
|
#line 16 "descriptor.pgc"
|
||||||
|
|
||||||
/* exec sql whenever not found sqlprint ; */
|
/* exec sql whenever not found sqlprint ; */
|
||||||
#line 15 "descriptor.pgc"
|
#line 17 "descriptor.pgc"
|
||||||
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
static unsigned STDCALL fn(void* arg)
|
static unsigned STDCALL fn(void* arg)
|
||||||
#else
|
#else
|
||||||
void* fn(void* arg)
|
static void* fn(void* arg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -109,16 +111,16 @@ void* fn(void* arg)
|
|||||||
for (i = 1; i <= REPEATS; ++i)
|
for (i = 1; i <= REPEATS; ++i)
|
||||||
{
|
{
|
||||||
ECPGallocate_desc(__LINE__, "mydesc");
|
ECPGallocate_desc(__LINE__, "mydesc");
|
||||||
#line 27 "descriptor.pgc"
|
#line 29 "descriptor.pgc"
|
||||||
|
|
||||||
if (sqlca.sqlcode < 0) sqlprint();
|
if (sqlca.sqlcode < 0) sqlprint();
|
||||||
#line 27 "descriptor.pgc"
|
#line 29 "descriptor.pgc"
|
||||||
|
|
||||||
ECPGdeallocate_desc(__LINE__, "mydesc");
|
ECPGdeallocate_desc(__LINE__, "mydesc");
|
||||||
#line 28 "descriptor.pgc"
|
#line 30 "descriptor.pgc"
|
||||||
|
|
||||||
if (sqlca.sqlcode < 0) sqlprint();
|
if (sqlca.sqlcode < 0) sqlprint();
|
||||||
#line 28 "descriptor.pgc"
|
#line 30 "descriptor.pgc"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,6 +129,7 @@ if (sqlca.sqlcode < 0) sqlprint();
|
|||||||
|
|
||||||
int main (int argc, char** argv)
|
int main (int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
int i;
|
int i;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
HANDLE threads[THREADS];
|
HANDLE threads[THREADS];
|
||||||
@ -150,6 +153,9 @@ int main (int argc, char** argv)
|
|||||||
for (i = 0; i < THREADS; ++i)
|
for (i = 0; i < THREADS; ++i)
|
||||||
pthread_join(threads[i], NULL);
|
pthread_join(threads[i], NULL);
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
fn(NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -5,6 +6,7 @@
|
|||||||
#else
|
#else
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define THREADS 16
|
#define THREADS 16
|
||||||
@ -17,7 +19,7 @@ EXEC SQL whenever not found sqlprint;
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
static unsigned STDCALL fn(void* arg)
|
static unsigned STDCALL fn(void* arg)
|
||||||
#else
|
#else
|
||||||
void* fn(void* arg)
|
static void* fn(void* arg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -33,6 +35,7 @@ void* fn(void* arg)
|
|||||||
|
|
||||||
int main (int argc, char** argv)
|
int main (int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
int i;
|
int i;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
HANDLE threads[THREADS];
|
HANDLE threads[THREADS];
|
||||||
@ -56,6 +59,9 @@ int main (int argc, char** argv)
|
|||||||
for (i = 0; i < THREADS; ++i)
|
for (i = 0; i < THREADS; ++i)
|
||||||
pthread_join(threads[i], NULL);
|
pthread_join(threads[i], NULL);
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
fn(NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user