aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/test/expected/thread-thread.c
diff options
context:
space:
mode:
authorThomas Munro <tmunro@postgresql.org>2023-07-12 06:20:37 +1200
committerThomas Munro <tmunro@postgresql.org>2023-07-12 08:20:43 +1200
commit68a4b58eca032916e2aad78d63f717dcb147e906 (patch)
treed944d9ffb794df9d70c6408475f20d20a0580080 /src/interfaces/ecpg/test/expected/thread-thread.c
parent11f36694091c97318e5a2bd28b35ffe9aa1c3b6a (diff)
downloadpostgresql-68a4b58eca032916e2aad78d63f717dcb147e906.tar.gz
postgresql-68a4b58eca032916e2aad78d63f717dcb147e906.zip
Remove --disable-thread-safety and related code.
All supported computers have either POSIX or Windows threads, and we no longer have any automated testing of --disable-thread-safety. We define a vestigial ENABLE_THREAD_SAFETY macro to 1 in ecpg_config.h in case it is useful, but we no longer test it anywhere in PostgreSQL code, and associated dead code paths are removed. The Meson and perl-based Windows build scripts never had an equivalent build option. Reviewed-by: Andres Freund <andres@anarazel.de> Reviewed-by: Peter Eisentraut <peter@eisentraut.org> Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi> Discussion: https://postgr.es/m/CA%2BhUKGLtmexrpMtxBRLCVePqV_dtWG-ZsEbyPrYc%2BNBB2TkNsw%40mail.gmail.com
Diffstat (limited to 'src/interfaces/ecpg/test/expected/thread-thread.c')
-rw-r--r--src/interfaces/ecpg/test/expected/thread-thread.c63
1 files changed, 27 insertions, 36 deletions
diff --git a/src/interfaces/ecpg/test/expected/thread-thread.c b/src/interfaces/ecpg/test/expected/thread-thread.c
index 0e75c47fab2..95faa223c20 100644
--- a/src/interfaces/ecpg/test/expected/thread-thread.c
+++ b/src/interfaces/ecpg/test/expected/thread-thread.c
@@ -15,14 +15,6 @@
#include <stdlib.h>
#include "ecpg_config.h"
-#ifndef ENABLE_THREAD_SAFETY
-int
-main(void)
-{
- printf("No threading enabled.\n");
- return 0;
-}
-#else
#ifndef WIN32
#include <pthread.h>
#else
@@ -38,7 +30,7 @@ main(void)
-#line 24 "thread.pgc"
+#line 16 "thread.pgc"
void *test_thread(void *arg);
@@ -57,10 +49,10 @@ int main()
/* exec sql begin declare section */
-#line 40 "thread.pgc"
+#line 32 "thread.pgc"
int l_rows ;
/* exec sql end declare section */
-#line 41 "thread.pgc"
+#line 33 "thread.pgc"
/* Do not switch on debug output for regression tests. The threads get executed in
@@ -69,22 +61,22 @@ int main()
/* setup test_thread table */
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
-#line 48 "thread.pgc"
+#line 40 "thread.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test_thread", ECPGt_EOIT, ECPGt_EORT);}
-#line 49 "thread.pgc"
+#line 41 "thread.pgc"
/* DROP might fail */
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 50 "thread.pgc"
+#line 42 "thread.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test_thread ( tstamp timestamp not null default cast ( timeofday ( ) as timestamp ) , thread text not null , iteration integer not null , primary key ( thread , iteration ) )", ECPGt_EOIT, ECPGt_EORT);}
-#line 55 "thread.pgc"
+#line 47 "thread.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 56 "thread.pgc"
+#line 48 "thread.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 57 "thread.pgc"
+#line 49 "thread.pgc"
/* create, and start, threads */
@@ -116,18 +108,18 @@ int main()
/* and check results */
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
-#line 87 "thread.pgc"
+#line 79 "thread.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from test_thread", ECPGt_EOIT,
ECPGt_int,&(l_rows),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
-#line 88 "thread.pgc"
+#line 80 "thread.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 89 "thread.pgc"
+#line 81 "thread.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 90 "thread.pgc"
+#line 82 "thread.pgc"
if( l_rows == (nthreads * iterations) )
printf("Success.\n");
@@ -145,13 +137,13 @@ void *test_thread(void *arg)
-#line 104 "thread.pgc"
+#line 96 "thread.pgc"
int l_i ;
-#line 105 "thread.pgc"
+#line 97 "thread.pgc"
char l_connection [ 128 ] ;
/* exec sql end declare section */
-#line 106 "thread.pgc"
+#line 98 "thread.pgc"
/* build up connection name, and connect to database */
@@ -161,13 +153,13 @@ void *test_thread(void *arg)
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#endif
/* exec sql whenever sqlerror sqlprint ; */
-#line 114 "thread.pgc"
+#line 106 "thread.pgc"
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , l_connection, 0);
-#line 115 "thread.pgc"
+#line 107 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 115 "thread.pgc"
+#line 107 "thread.pgc"
if( sqlca.sqlcode != 0 )
{
@@ -175,10 +167,10 @@ if (sqlca.sqlcode < 0) sqlprint();}
return NULL;
}
{ ECPGtrans(__LINE__, l_connection, "begin");
-#line 121 "thread.pgc"
+#line 113 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 121 "thread.pgc"
+#line 113 "thread.pgc"
/* insert into test_thread table */
@@ -189,10 +181,10 @@ if (sqlca.sqlcode < 0) sqlprint();}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,&(l_i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 126 "thread.pgc"
+#line 118 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 126 "thread.pgc"
+#line 118 "thread.pgc"
if( sqlca.sqlcode != 0 )
printf("%s: ERROR: insert failed!\n", l_connection);
@@ -200,17 +192,16 @@ if (sqlca.sqlcode < 0) sqlprint();}
/* all done */
{ ECPGtrans(__LINE__, l_connection, "commit");
-#line 132 "thread.pgc"
+#line 124 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 132 "thread.pgc"
+#line 124 "thread.pgc"
{ ECPGdisconnect(__LINE__, l_connection);
-#line 133 "thread.pgc"
+#line 125 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 133 "thread.pgc"
+#line 125 "thread.pgc"
return NULL;
}
-#endif /* ENABLE_THREAD_SAFETY */