mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
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
This commit is contained in:
@@ -137,7 +137,7 @@ typedef struct socket_set
|
||||
EnterSynchronizationBarrier((barrier), \
|
||||
SYNCHRONIZATION_BARRIER_FLAGS_BLOCK_ONLY)
|
||||
#define THREAD_BARRIER_DESTROY(barrier)
|
||||
#elif defined(ENABLE_THREAD_SAFETY)
|
||||
#else
|
||||
/* Use POSIX threads */
|
||||
#include "port/pg_pthread.h"
|
||||
#define THREAD_T pthread_t
|
||||
@@ -153,16 +153,6 @@ typedef struct socket_set
|
||||
pthread_barrier_init((barrier), NULL, (n))
|
||||
#define THREAD_BARRIER_WAIT(barrier) pthread_barrier_wait((barrier))
|
||||
#define THREAD_BARRIER_DESTROY(barrier) pthread_barrier_destroy((barrier))
|
||||
#else
|
||||
/* No threads implementation, use none (-j 1) */
|
||||
#define THREAD_T void *
|
||||
#define THREAD_FUNC_RETURN_TYPE void *
|
||||
#define THREAD_FUNC_RETURN return NULL
|
||||
#define THREAD_FUNC_CC
|
||||
#define THREAD_BARRIER_T int
|
||||
#define THREAD_BARRIER_INIT(barrier, n) (*(barrier) = 0)
|
||||
#define THREAD_BARRIER_WAIT(barrier)
|
||||
#define THREAD_BARRIER_DESTROY(barrier)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -6749,10 +6739,6 @@ main(int argc, char **argv)
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
#ifndef ENABLE_THREAD_SAFETY
|
||||
if (nthreads != 1)
|
||||
pg_fatal("threads are not supported on this platform; use -j1");
|
||||
#endif /* !ENABLE_THREAD_SAFETY */
|
||||
break;
|
||||
case 'l':
|
||||
benchmarking_option_set = true;
|
||||
@@ -7236,7 +7222,6 @@ main(int argc, char **argv)
|
||||
if (errno != 0)
|
||||
pg_fatal("could not initialize barrier: %m");
|
||||
|
||||
#ifdef ENABLE_THREAD_SAFETY
|
||||
/* start all threads but thread 0 which is executed directly later */
|
||||
for (i = 1; i < nthreads; i++)
|
||||
{
|
||||
@@ -7248,9 +7233,6 @@ main(int argc, char **argv)
|
||||
if (errno != 0)
|
||||
pg_fatal("could not create thread: %m");
|
||||
}
|
||||
#else
|
||||
Assert(nthreads == 1);
|
||||
#endif /* ENABLE_THREAD_SAFETY */
|
||||
|
||||
/* compute when to stop */
|
||||
threads[0].create_time = pg_time_now();
|
||||
@@ -7268,10 +7250,8 @@ main(int argc, char **argv)
|
||||
{
|
||||
TState *thread = &threads[i];
|
||||
|
||||
#ifdef ENABLE_THREAD_SAFETY
|
||||
if (i > 0)
|
||||
THREAD_JOIN(thread->thread);
|
||||
#endif /* ENABLE_THREAD_SAFETY */
|
||||
|
||||
for (int j = 0; j < thread->nstate; j++)
|
||||
if (thread->state[j].state != CSTATE_FINISHED)
|
||||
|
||||
Reference in New Issue
Block a user