summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2021-10-27 17:54:20 +0100
committerRobin Watts <Robin.Watts@artifex.com>2021-11-05 14:32:19 +0000
commit91e29d42a601689f13e9202fc6b582d53901fbc2 (patch)
tree7a8526c18f050af408749cc587a49a0ca13b1474 /configure.ac
parent6dd05a013f66a9322f92f62fd2d46be9bfa82097 (diff)
downloadghostpdl-91e29d42a601689f13e9202fc6b582d53901fbc2.tar.gz
Runtime safety of non threadsafe devices and rework globals.
Some devices within Ghostscript (currently the x11 devices, uniprint and opvp/oprp) use non const static variables, so cannot be run in multiple instances at a time. We now maintain a core "count" of how many non-threadsafe devices are being used at any time. This value can be atomically adjusted by calls to gs_lib_ctx_nts_adjust. Non threadsafe devices now call gx_init_non_threadsafe_device either as or as part of their initialise_device proc. This function attempts to increment the non-threadsafe count and fails to init if there is already a non-threadsafe device running. On success, the device finalize method is modified so that it will decrement the count at the end. The known non-threadsafe devices are updated to call this. In order to have somewhere safe to store this count, we introduce a gs_globals structure, shared between instances. Setting this up without race conditions requires some new gp_ functions that can make use of platform specific threading primitives. We have these implemented for both windows and pthread based platforms. On other platforms, we drop back to the old unsafe mechanism for counting instances. While we do this work, we take the opportunity to push the gs_memory_t pointer used for non-threadsafe debug printing into thread local storage. This enables us to remove the remaining GS_THREADSAFE guarded compilation from the source code. What is left is broadly down to allowing debugging collection for statistics, and these are now controlled by specific COLLECT_STATS_XXX defines. It is assumed that anyone wanting to collect such stats is smart enough to not try to do so while using Ghostscript in a multi-instance environment.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac73
1 files changed, 0 insertions, 73 deletions
diff --git a/configure.ac b/configure.ac
index a1782609d..a1b72f84a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,20 +49,6 @@ ARCH_AUTOCONF_HEADER=arch-config/arch_autoconf.h
ARCH_AUTOCONF_HEADER_PROTO=arch/arch_autoconf.h.in
dnl --------------------------------------------------
-dnl List of non-threadsafe devices
-dnl defined at the top of the file for ease of access
-dnl --------------------------------------------------
-
-NTS_DEVS='opvp oprp'
-NTS_DEVS="$NTS_DEVS uniprint"
-NTS_DEVS="$NTS_DEVS x11 x11alpha"
-
-# We use this to store a list of devices we have excluded
-# and emit a warning on completion.
-NTS_EXCLUDES=""
-
-
-dnl --------------------------------------------------
dnl Local utilities
dnl --------------------------------------------------
@@ -562,15 +548,6 @@ CFLAGS=$save_cflags
dnl --------------------------------------------------
-dnl Enable thread safe build
-dnl --------------------------------------------------
-AC_ARG_ENABLE([threadsafe], AS_HELP_STRING([--enable-threadsafe],
- [enable a thread safe build - NOTE: this will exclude non-threadsafe devices]))
-if test x$enable_threadsafe = xyes ; then
- CFLAGS="-DGS_THREADSAFE"
-fi
-
-dnl --------------------------------------------------
dnl Check for headers
dnl --------------------------------------------------
@@ -2804,51 +2781,6 @@ while test -n "$drivers"; do
esac
done
-if test x$enable_threadsafe = xyes; then
-
- for ntsdev in $NTS_DEVS ; do
- NTS_EXCLUDES="$(echo \"$P_DEVS0{[@]:0}\" | grep -o $ntsdev) $NTS_EXCLUDES"
- P_DEVS0=`echo $P_DEVS0 | sed "s/\b$ntsdev\b//g"`
- done
-
- for ntsdev in $NTS_DEVS ; do
- NTS_EXCLUDES="$(echo \"$F_DEVS0{[@]:0}\" | grep -o $ntsdev) $NTS_EXCLUDES"
- F_DEVS0=`echo $F_DEVS0 | sed "s/\b$ntsdev\b//g"`
- done
-
- for ntsdev in $NTS_DEVS ; do
- NTS_EXCLUDES="$(echo \"$CUPS_DEVS0{[@]:0}\" | grep -o $ntsdev) $NTS_EXCLUDES"
- CUPS_DEVS0=`echo $CUPS_DEVS0 | sed "s/\b$ntsdev\b//g"`
- done
-
- for ntsdev in $NTS_DEVS ; do
- NTS_EXCLUDES="$(echo \"$XPS_DEVS0{[@]:0}\" | grep -o $ntsdev) $NTS_EXCLUDES"
- XPS_DEVS0=`echo $XPS_DEVS0 | sed "s/\b$ntsdev\b//g"`
- done
-
- for ntsdev in $NTS_DEVS ; do
- NTS_EXCLUDES="$(echo \"$IJS_DEVS0{[@]:0}\" | grep -o $ntsdev) $NTS_EXCLUDES"
- IJS_DEVS0=`echo $IJS_DEVS0 | sed "s/\b$ntsdev\b//g"`
- done
-
- for ntsdev in $NTS_DEVS ; do
- NTS_EXCLUDES="$(echo \"$PNG_DEVS0{[@]:0}\" | grep -o $ntsdev) $NTS_EXCLUDES"
- PNG_DEVS0=`echo $PNG_DEVS0 | sed "s/\b$ntsdev\b//g"`
- done
-
- for ntsdev in $NTS_DEVS ; do
- NTS_EXCLUDES="$(echo \"$X11_DEVS0{[@]:0}\" | grep -o $ntsdev) $NTS_EXCLUDES"
- X11_DEVS0=`echo $X11_DEVS0 | sed "s/\b$ntsdev\b//g"`
- done
-
- for ntsdev in $NTS_DEVS ; do
- NTS_EXCLUDES="$(echo \"$JBIG2_DEVS{[@]:0}\" | grep -o $ntsdev) $NTS_EXCLUDES"
- JBIG2_DEVS=`echo $JBIG2_DEVS | sed "s/\b$ntsdev\b//g"`
- done
-
- NTS_EXCLUDES=`echo "$NTS_EXCLUDES" | tr " " "\n" | sort | uniq | tr "\n" " "`
-fi # x$enable_threadsafe = xyes
-
noncontribmakefiles=`find $srcdir -name '*.mak' -print | grep -v '/contrib/'`
# No need to include opvp/oprp driver without iconv/libiconv.
@@ -3761,11 +3693,6 @@ if test "x$AFS" = "x1"; then
AC_MSG_WARN([Support for this will be removed in a future release])
fi
-if test "x$NTS_EXCLUDES" != "x" ; then
- AC_MSG_WARN([Due to the --enable-threadsafe option, the following devices have been excluded because they are not threadsafe:])
- echo "$NTS_EXCLUDES"
-fi
-
if test x"$OCR_DEVS_WARNING_LINE1" != x"" ; then
echo ""
AC_MSG_WARN([$OCR_DEVS_WARNING_LINE1])