Tcl package Thread source code

Changes On Branch thread-2-7for84+
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch thread-2-7for84+ Excluding Merge-Ins

This is equivalent to a diff from 9cbfc3b299 to 0da0b1fa18

2012-11-12
09:20
Merged thread-2-7for84+. Fixed race condition in ThreadCancel(). check-in: 5a81d6720d user: zoran tags: trunk
2012-11-08
14:56
Branch for Thread 2.7.0 release. check-in: 602d349e33 user: dgp tags: thread-2-7-0-rc
2012-11-06
15:50
... But only do "package ifneeded Thread" when tread support for Tcl is already determined. Closed-Leaf check-in: 0da0b1fa18 user: jan.nijtmans tags: thread-2-7for84+
15:45
Use tcl_platform(threaded) on Tcl8.4 and [::tcl::pkgconfig get threaded] on higher Tcl version, for testing whether Tcl is compiled with threads support. check-in: b8d3e72748 user: jan.nijtmans tags: thread-2-7for84+
2012-11-05
10:52
merge trunk check-in: 887c5b1bf5 user: jan.nijtmans tags: thread-2-7for84+
10:49
bug-fix: Allow the thread::wait command to return stack-traces of both the current thread and the waited-for thread. check-in: 9cbfc3b299 user: jan.nijtmans tags: trunk
2012-09-18
09:36
make testcases work outside build directory, when Thread is installed check-in: 21ffb00ee4 user: jan.nijtmans tags: trunk

Changes to Makefile.in.

150
151
152
153
154
155
156
157
158
159
160
161
162
163
164

CONFIG_CLEAN_FILES = Makefile pkgIndex.tcl
CLEANFILES	= @CLEANFILES@

CPPFLAGS	= @CPPFLAGS@
LIBS		= @PKG_LIBS@ @LIBS@
AR		= @AR@
CFLAGS		= @CFLAGS@
COMPILE		= $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)

#========================================================================
# Start of user-definable TARGETS section
#========================================================================

#========================================================================







|







150
151
152
153
154
155
156
157
158
159
160
161
162
163
164

CONFIG_CLEAN_FILES = Makefile pkgIndex.tcl
CLEANFILES	= @CLEANFILES@

CPPFLAGS	= @CPPFLAGS@
LIBS		= @PKG_LIBS@ @LIBS@
AR		= @AR@
CFLAGS		= @CFLAGS@ -DUSE_INTERP_ERRORLINE
COMPILE		= $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)

#========================================================================
# Start of user-definable TARGETS section
#========================================================================

#========================================================================
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294

dist-clean:
	rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.*

dist: dist-clean
	mkdir -p $(DIST_DIR)
	cp -p $(srcdir)/ChangeLog $(srcdir)/README* $(srcdir)/license.terms \
		$(srcdir)/aclocal.m4 $(srcdir)/aolserver.m4 $(srcdir)/configure \
        $(srcdir)/*.in \
		$(DIST_DIR)/
	chmod 664 $(DIST_DIR)/Makefile.in $(DIST_DIR)/aclocal.m4
	chmod 775 $(DIST_DIR)/configure $(DIST_DIR)/configure.in

	mkdir $(DIST_DIR)/tclconfig
	cp $(srcdir)/tclconfig/install-sh $(srcdir)/tclconfig/tcl.m4 \







|







280
281
282
283
284
285
286
287
288
289
290
291
292
293
294

dist-clean:
	rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.*

dist: dist-clean
	mkdir -p $(DIST_DIR)
	cp -p $(srcdir)/ChangeLog $(srcdir)/README* $(srcdir)/license.terms \
		$(srcdir)/aclocal.m4 $(srcdir)/naviserver.m4 $(srcdir)/configure \
        $(srcdir)/*.in \
		$(DIST_DIR)/
	chmod 664 $(DIST_DIR)/Makefile.in $(DIST_DIR)/aclocal.m4
	chmod 775 $(DIST_DIR)/configure $(DIST_DIR)/configure.in

	mkdir $(DIST_DIR)/tclconfig
	cp $(srcdir)/tclconfig/install-sh $(srcdir)/tclconfig/tcl.m4 \

Changes to README.

1
2
3
4
5
6
7
8






9
10
11
12
13
14
15

WHAT IS THIS ?
==============

This is the source distribution of the Tcl Thread extension. 
You can use this extension to gain script-level access to Tcl 
threading capabilities.
The extension can be used with Tcl cores starting from Tcl8.6 and later.







You need to have your Tcl core compiled with "--enable-threads" in order
to turn on internal directives supporting thread-specific details of the
Tcl API. The extension will not load in an Tcl shell built w/o thread
support. 

This extension is a freely available open source package. You can do 







|
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

WHAT IS THIS ?
==============

This is the source distribution of the Tcl Thread extension. 
You can use this extension to gain script-level access to Tcl 
threading capabilities.
The extension can be used with Tcl cores starting from Tcl8.4 and later.
(This beta can be compiled using Tcl8.4 or later, and it can run with
Tcl8.5 and later. The only reason why it cannot run with Tcl 8.4 is
because Tcl 8.4 cannot handle package versions with "b" in it. Therefore
the final Thread 2.7for84+ release will run fine with Tcl 8.4)
Also, this extension supports, i.e. can be used as a loadable module of,
AOLserver 4.x series of the highly-scalable web server from America Online. 

You need to have your Tcl core compiled with "--enable-threads" in order
to turn on internal directives supporting thread-specific details of the
Tcl API. The extension will not load in an Tcl shell built w/o thread
support. 

This extension is a freely available open source package. You can do 

Changes to aclocal.m4.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#
# Pull in the standard Tcl autoconf macros.
# If you don't have the "tclconfig" subdirectory, it is a dependent CVS
# module. Either "cvs -d <root> checkout tclconfig" right here, or
# re-checkout the thread module
#
builtin(include,tclconfig/tcl.m4)
builtin(include,aolserver.m4)

#
# Handle the "--with-gdbm" option for linking-in
# the gdbm-based peristent store for shared arrays.
# It tries to locate gdbm files in couple of standard
# system directories and/or common install locations
# in addition to the directory passed by the user.







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#
# Pull in the standard Tcl autoconf macros.
# If you don't have the "tclconfig" subdirectory, it is a dependent CVS
# module. Either "cvs -d <root> checkout tclconfig" right here, or
# re-checkout the thread module
#
builtin(include,tclconfig/tcl.m4)
builtin(include,naviserver.m4)

#
# Handle the "--with-gdbm" option for linking-in
# the gdbm-based peristent store for shared arrays.
# It tries to locate gdbm files in couple of standard
# system directories and/or common install locations
# in addition to the directory passed by the user.

Deleted aolserver.m4.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

#------------------------------------------------------------------------
# NS_PATH_AOLSERVER
#
#   Allows the building with support for AOLserver
#
# Arguments:
#   none
#
# Results:
#
#   Adds the following arguments to configure:
#       --with-aolserver=...
#
#   Defines the following vars:
#       AOL_DIR Full path to the directory containing AOLserver distro
#       AOL_INCLUDES
#       AOL_LIBS
#
#   Sets the following vars:
#       NS_AOLSERVER
#
#   Updates following vars:
#------------------------------------------------------------------------

AC_DEFUN(NS_PATH_AOLSERVER, [
    AC_MSG_CHECKING([for AOLserver configuration])
    AC_ARG_WITH(aolserver,
    [  --with-aolserver        directory with AOLserver distribution],\
    with_aolserver=${withval})

    AC_CACHE_VAL(ac_cv_c_aolserver,[
    if test x"${with_aolserver}" != x ; then
        if test -f "${with_aolserver}/include/ns.h" ; then
            ac_cv_c_aolserver=`(cd ${with_aolserver}; pwd)`
        else
            AC_MSG_ERROR([${with_aolserver} directory doesn't contain ns.h])
        fi
    fi
    ])
    if test x"${ac_cv_c_aolserver}" = x ; then
        AC_MSG_RESULT([none found])
    else
        AOL_DIR=${ac_cv_c_aolserver}
        AC_MSG_RESULT([found AOLserver in $AOL_DIR])
        AOL_INCLUDES="-I\"${AOL_DIR}/include\""
        if test "`uname -s`" = Darwin ; then
            aollibs=`ls ${AOL_DIR}/lib/libns* 2>/dev/null`
            if test x"$aollibs" != x ; then
                AOL_LIBS="-L\"${AOL_DIR}/lib\" -lnsd -lnsthread"
            fi
        fi
        AC_DEFINE(NS_AOLSERVER)
    fi
])

# EOF
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































Changes to configure.

1
2
3
4
5
6
7
8
9
10
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for thread 2.7b1.
#
# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## --------------------- ##
## M4sh Initialization.  ##
## --------------------- ##


|







1
2
3
4
5
6
7
8
9
10
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for thread 2.7.0.
#
# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## --------------------- ##
## M4sh Initialization.  ##
## --------------------- ##
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# This variable seems obsolete.  It should probably be removed, and
# only ac_max_sed_lines should be used.
: ${ac_max_here_lines=38}

# Identity of this package.
PACKAGE_NAME='thread'
PACKAGE_TARNAME='thread'
PACKAGE_VERSION='2.7b1'
PACKAGE_STRING='thread 2.7b1'
PACKAGE_BUGREPORT=''

# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>







|
|







263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# This variable seems obsolete.  It should probably be removed, and
# only ac_max_sed_lines should be used.
: ${ac_max_here_lines=38}

# Identity of this package.
PACKAGE_NAME='thread'
PACKAGE_TARNAME='thread'
PACKAGE_VERSION='2.7.0'
PACKAGE_STRING='thread 2.7.0'
PACKAGE_BUGREPORT=''

# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
  # Omit some internal or obsolete options to make the list less imposing.
  # This message is too long to be a string in the A/UX 3.1 sh.
  cat <<_ACEOF
\`configure' configures thread 2.7b1 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.







|







773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
  # Omit some internal or obsolete options to make the list less imposing.
  # This message is too long to be a string in the A/UX 3.1 sh.
  cat <<_ACEOF
\`configure' configures thread 2.7.0 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865

  cat <<\_ACEOF
_ACEOF
fi

if test -n "$ac_init_help"; then
  case $ac_init_help in
     short | recursive ) echo "Configuration of thread 2.7b1:";;
   esac
  cat <<\_ACEOF

Optional Features:
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-threads        build with threads
  --enable-shared         build and link with shared libraries (default: on)
  --enable-64bit          enable 64bit support (default: off)
  --enable-64bit-vis      enable 64bit Sparc VIS support (default: off)
  --disable-rpath         disable rpath support (default: on)
  --enable-wince          enable Win/CE support (where applicable)
  --enable-symbols        build with debugging symbols (default: off)

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-tcl              directory containing tcl configuration
                          (tclConfig.sh)
  --with-gdbm             link with optional GDBM support
  --with-aolserver        directory with AOLserver distribution
  --with-tclinclude       directory containing the public Tcl header files
  --with-celib=DIR        use Windows/CE support library from DIR

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a







|




















|







830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865

  cat <<\_ACEOF
_ACEOF
fi

if test -n "$ac_init_help"; then
  case $ac_init_help in
     short | recursive ) echo "Configuration of thread 2.7.0:";;
   esac
  cat <<\_ACEOF

Optional Features:
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-threads        build with threads
  --enable-shared         build and link with shared libraries (default: on)
  --enable-64bit          enable 64bit support (default: off)
  --enable-64bit-vis      enable 64bit Sparc VIS support (default: off)
  --disable-rpath         disable rpath support (default: on)
  --enable-wince          enable Win/CE support (where applicable)
  --enable-symbols        build with debugging symbols (default: off)

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-tcl              directory containing tcl configuration
                          (tclConfig.sh)
  --with-gdbm             link with optional GDBM support
  --with-naviserver       directory with NaviServer/AOLserver distribution
  --with-tclinclude       directory containing the public Tcl header files
  --with-celib=DIR        use Windows/CE support library from DIR

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
    cd $ac_popdir
  done
fi

test -n "$ac_init_help" && exit 0
if $ac_init_version; then
  cat <<\_ACEOF
thread configure 2.7b1
generated by GNU Autoconf 2.59

Copyright (C) 2003 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
  exit 0
fi
exec 5>config.log
cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by thread $as_me 2.7b1, which was
generated by GNU Autoconf 2.59.  Invocation command line was

  $ $0 $@

_ACEOF
{
cat <<_ASUNAME







|













|







962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
    cd $ac_popdir
  done
fi

test -n "$ac_init_help" && exit 0
if $ac_init_version; then
  cat <<\_ACEOF
thread configure 2.7.0
generated by GNU Autoconf 2.59

Copyright (C) 2003 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
  exit 0
fi
exec 5>config.log
cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by thread $as_me 2.7.0, which was
generated by GNU Autoconf 2.59.  Invocation command line was

  $ $0 $@

_ACEOF
{
cat <<_ASUNAME
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732






if test "${TCL_MAJOR_VERSION}" -ne 8 ; then
    { { echo "$as_me:$LINENO: error: ${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+
Found config for Tcl ${TCL_VERSION}" >&5
echo "$as_me: error: ${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+
Found config for Tcl ${TCL_VERSION}" >&2;}
   { (exit 1); exit 1; }; }
fi
if test "${TCL_MINOR_VERSION}" -lt 6 ; then
    { { echo "$as_me:$LINENO: error: ${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+
Found config for Tcl ${TCL_VERSION}" >&5
echo "$as_me: error: ${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+
Found config for Tcl ${TCL_VERSION}" >&2;}
   { (exit 1); exit 1; }; }
fi


#--------------------------------------------------------------------
# Load the tkConfig.sh file if necessary (Tk extension)
#--------------------------------------------------------------------

#TEA_PATH_TKCONFIG
#TEA_LOAD_TKCONFIG







|

|



|
|

|



<







2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724

2725
2726
2727
2728
2729
2730
2731






if test "${TCL_MAJOR_VERSION}" -ne 8 ; then
    { { echo "$as_me:$LINENO: error: ${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.4+
Found config for Tcl ${TCL_VERSION}" >&5
echo "$as_me: error: ${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.4+
Found config for Tcl ${TCL_VERSION}" >&2;}
   { (exit 1); exit 1; }; }
fi
if test "${TCL_MINOR_VERSION}" -lt 4 ; then
    { { echo "$as_me:$LINENO: error: ${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.4+
Found config for Tcl ${TCL_VERSION}" >&5
echo "$as_me: error: ${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.4+
Found config for Tcl ${TCL_VERSION}" >&2;}
   { (exit 1); exit 1; }; }
fi


#--------------------------------------------------------------------
# Load the tkConfig.sh file if necessary (Tk extension)
#--------------------------------------------------------------------

#TEA_PATH_TKCONFIG
#TEA_LOAD_TKCONFIG
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030

7031
7032
7033
7034
7035
7036
7037
7038
            GDBM_LIBS="-L\"$glibdir\" -lgdbm"
        fi
    fi
    fi


#--------------------------------------------------------------------
# Locate the AOLserver dir for compilation as AOLserver module.
# This will declare AOL_INCLUDES, AOL_LIBS and define NS_AOLSERVER.
#--------------------------------------------------------------------


    echo "$as_me:$LINENO: checking for AOLserver configuration" >&5
echo $ECHO_N "checking for AOLserver configuration... $ECHO_C" >&6

# Check whether --with-aolserver or --without-aolserver was given.
if test "${with_aolserver+set}" = set; then
  withval="$with_aolserver"
  \
    with_aolserver=${withval}
fi;

    if test "${ac_cv_c_aolserver+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else

    if test x"${with_aolserver}" != x ; then
        if test -f "${with_aolserver}/include/ns.h" ; then
            ac_cv_c_aolserver=`(cd ${with_aolserver}; pwd)`
        else
            { { echo "$as_me:$LINENO: error: ${with_aolserver} directory doesn't contain ns.h" >&5
echo "$as_me: error: ${with_aolserver} directory doesn't contain ns.h" >&2;}
   { (exit 1); exit 1; }; }
        fi
    fi

fi

    if test x"${ac_cv_c_aolserver}" = x ; then
        echo "$as_me:$LINENO: result: none found" >&5
echo "${ECHO_T}none found" >&6
    else
        AOL_DIR=${ac_cv_c_aolserver}
        echo "$as_me:$LINENO: result: found AOLserver in $AOL_DIR" >&5
echo "${ECHO_T}found AOLserver in $AOL_DIR" >&6
        AOL_INCLUDES="-I\"${AOL_DIR}/include\""
        if test "`uname -s`" = Darwin ; then
            aollibs=`ls ${AOL_DIR}/lib/libns* 2>/dev/null`
            if test x"$aollibs" != x ; then
                AOL_LIBS="-L\"${AOL_DIR}/lib\" -lnsd -lnsthread"
            fi
        fi
        cat >>confdefs.h <<\_ACEOF
#define NS_AOLSERVER 1
_ACEOF

    fi


#-----------------------------------------------------------------------
# __CHANGE__
# Specify the C source files to compile in TEA_ADD_SOURCES,
# public headers that need to be installed in TEA_ADD_HEADERS,
# stub library C source files to compile in TEA_ADD_STUB_SOURCES,
# and runtime Tcl library files in TEA_ADD_TCL_SOURCES.
# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS
# and PKG_TCL_SOURCES.
#-----------------------------------------------------------------------



    vars="generic/threadCmd.c          \
                 generic/threadSvCmd.c        \
                 generic/threadSpCmd.c        \
                 generic/threadPoolCmd.c      \
                 generic/psGdbm.c             \
                 generic/threadSvListCmd.c    \
                 generic/threadSvKeylistCmd.c \
                 generic/tclXkeylist.c        \







|
|



|
|

|
|
|

|


|



|
|
|

|
|






|



|
|
|
|

|

|




















>
|







6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
            GDBM_LIBS="-L\"$glibdir\" -lgdbm"
        fi
    fi
    fi


#--------------------------------------------------------------------
# Locate the NaviServer/AOLserver dir for compilation as NaviServer/AOLserver module.
# This will declare NS_INCLUDES, NS_LIBS and define NS_AOLSERVER.
#--------------------------------------------------------------------


    echo "$as_me:$LINENO: checking for NaviServer/AOLserver configuration" >&5
echo $ECHO_N "checking for NaviServer/AOLserver configuration... $ECHO_C" >&6

# Check whether --with-naviserver or --without-naviserver was given.
if test "${with_naviserver+set}" = set; then
  withval="$with_naviserver"
  \
    with_naviserver=${withval}
fi;

    if test "${ac_cv_c_naviserver+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else

    if test x"${with_naviserver}" != x ; then
        if test -f "${with_naviserver}/include/ns.h" ; then
            ac_cv_c_naviserver=`(cd ${with_naviserver}; pwd)`
        else
            { { echo "$as_me:$LINENO: error: ${with_naviserver} directory doesn't contain ns.h" >&5
echo "$as_me: error: ${with_naviserver} directory doesn't contain ns.h" >&2;}
   { (exit 1); exit 1; }; }
        fi
    fi

fi

    if test x"${ac_cv_c_naviserver}" = x ; then
        echo "$as_me:$LINENO: result: none found" >&5
echo "${ECHO_T}none found" >&6
    else
        NS_DIR=${ac_cv_c_naviserver}
        echo "$as_me:$LINENO: result: found NaviServer/AOLserver in $NS_DIR" >&5
echo "${ECHO_T}found NaviServer/AOLserver in $NS_DIR" >&6
        NS_INCLUDES="-I\"${NS_DIR}/include\""
        if test "`uname -s`" = Darwin ; then
            aollibs=`ls ${NS_DIR}/lib/libns* 2>/dev/null`
            if test x"$aollibs" != x ; then
                NS_LIBS="-L\"${NS_DIR}/lib\" -lnsd -lnsthread"
            fi
        fi
        cat >>confdefs.h <<\_ACEOF
#define NS_AOLSERVER 1
_ACEOF

    fi


#-----------------------------------------------------------------------
# __CHANGE__
# Specify the C source files to compile in TEA_ADD_SOURCES,
# public headers that need to be installed in TEA_ADD_HEADERS,
# stub library C source files to compile in TEA_ADD_STUB_SOURCES,
# and runtime Tcl library files in TEA_ADD_TCL_SOURCES.
# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS
# and PKG_TCL_SOURCES.
#-----------------------------------------------------------------------


    vars="generic/threadNs.c           \
                 generic/threadCmd.c          \
                 generic/threadSvCmd.c        \
                 generic/threadSpCmd.c        \
                 generic/threadPoolCmd.c      \
                 generic/psGdbm.c             \
                 generic/threadSvListCmd.c    \
                 generic/threadSvKeylistCmd.c \
                 generic/tclXkeylist.c        \
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
   { (exit 1); exit 1; }; }
	fi
	PKG_HEADERS="$PKG_HEADERS $i"
    done



    vars="${AOL_INCLUDES}"
    for i in $vars; do
	PKG_INCLUDES="$PKG_INCLUDES $i"
    done



    vars="${GDBM_LIBS} ${AOL_LIBS}"
    for i in $vars; do
	if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
	    # Convert foo.lib to -lfoo for GCC.  No-op if not *.lib
	    i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'`
	fi
	PKG_LIBS="$PKG_LIBS $i"
    done







|






|







7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
   { (exit 1); exit 1; }; }
	fi
	PKG_HEADERS="$PKG_HEADERS $i"
    done



    vars="${NS_INCLUDES}"
    for i in $vars; do
	PKG_INCLUDES="$PKG_INCLUDES $i"
    done



    vars="${GDBM_LIBS} ${NS_LIBS}"
    for i in $vars; do
	if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
	    # Convert foo.lib to -lfoo for GCC.  No-op if not *.lib
	    i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'`
	fi
	PKG_LIBS="$PKG_LIBS $i"
    done
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
  echo
  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
} >&5
cat >&5 <<_CSEOF

This file was extended by thread $as_me 2.7b1, which was
generated by GNU Autoconf 2.59.  Invocation command line was

  CONFIG_FILES    = $CONFIG_FILES
  CONFIG_HEADERS  = $CONFIG_HEADERS
  CONFIG_LINKS    = $CONFIG_LINKS
  CONFIG_COMMANDS = $CONFIG_COMMANDS
  $ $0 $@







|







11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
  echo
  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
} >&5
cat >&5 <<_CSEOF

This file was extended by thread $as_me 2.7.0, which was
generated by GNU Autoconf 2.59.  Invocation command line was

  CONFIG_FILES    = $CONFIG_FILES
  CONFIG_HEADERS  = $CONFIG_HEADERS
  CONFIG_LINKS    = $CONFIG_LINKS
  CONFIG_COMMANDS = $CONFIG_COMMANDS
  $ $0 $@
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
$config_files

Report bugs to <[email protected]>."
_ACEOF

cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
thread config.status 2.7b1
configured by $0, generated by GNU Autoconf 2.59,
  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"

Copyright (C) 2003 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
srcdir=$srcdir







|







11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
$config_files

Report bugs to <[email protected]>."
_ACEOF

cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
thread config.status 2.7.0
configured by $0, generated by GNU Autoconf 2.59,
  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"

Copyright (C) 2003 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
srcdir=$srcdir

Changes to configure.in.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Set your package name and version numbers here.
#
# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION
# set as provided.  These will also be added as -D defs in your Makefile
# so you can encode the package version directly into the source files.
#-----------------------------------------------------------------------

AC_INIT([thread], [2.7b1])

#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
#--------------------------------------------------------------------

TEA_INIT([3.9])

AC_CONFIG_AUX_DIR(tclconfig)

#--------------------------------------------------------------------
# Load the tclConfig.sh file
#--------------------------------------------------------------------

TEA_PATH_TCLCONFIG
TEA_LOAD_TCLCONFIG

if test "${TCL_MAJOR_VERSION}" -ne 8 ; then
    AC_MSG_ERROR([${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+
Found config for Tcl ${TCL_VERSION}])
fi
if test "${TCL_MINOR_VERSION}" -lt 6 ; then
    AC_MSG_ERROR([${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+
Found config for Tcl ${TCL_VERSION}])
fi


#--------------------------------------------------------------------
# Load the tkConfig.sh file if necessary (Tk extension)
#--------------------------------------------------------------------

#TEA_PATH_TKCONFIG
#TEA_LOAD_TKCONFIG







|



















|


|
|


<







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

47
48
49
50
51
52
53
# Set your package name and version numbers here.
#
# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION
# set as provided.  These will also be added as -D defs in your Makefile
# so you can encode the package version directly into the source files.
#-----------------------------------------------------------------------

AC_INIT([thread], [2.7.0])

#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
#--------------------------------------------------------------------

TEA_INIT([3.9])

AC_CONFIG_AUX_DIR(tclconfig)

#--------------------------------------------------------------------
# Load the tclConfig.sh file
#--------------------------------------------------------------------

TEA_PATH_TCLCONFIG
TEA_LOAD_TCLCONFIG

if test "${TCL_MAJOR_VERSION}" -ne 8 ; then
    AC_MSG_ERROR([${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.4+
Found config for Tcl ${TCL_VERSION}])
fi
if test "${TCL_MINOR_VERSION}" -lt 4 ; then
    AC_MSG_ERROR([${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.4+
Found config for Tcl ${TCL_VERSION}])
fi


#--------------------------------------------------------------------
# Load the tkConfig.sh file if necessary (Tk extension)
#--------------------------------------------------------------------

#TEA_PATH_TKCONFIG
#TEA_LOAD_TKCONFIG
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96

97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Check if building with optional Gdbm package. This will declare
# GDBM_CFLAGS and GDBM_LIBS variables.
#--------------------------------------------------------------------

TCLTHREAD_WITH_GDBM

#--------------------------------------------------------------------
# Locate the AOLserver dir for compilation as AOLserver module.
# This will declare AOL_INCLUDES, AOL_LIBS and define NS_AOLSERVER.
#--------------------------------------------------------------------

NS_PATH_AOLSERVER

#-----------------------------------------------------------------------
# __CHANGE__
# Specify the C source files to compile in TEA_ADD_SOURCES,
# public headers that need to be installed in TEA_ADD_HEADERS,
# stub library C source files to compile in TEA_ADD_STUB_SOURCES,
# and runtime Tcl library files in TEA_ADD_TCL_SOURCES.
# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS
# and PKG_TCL_SOURCES.
#-----------------------------------------------------------------------

TEA_ADD_SOURCES([generic/threadCmd.c          \

                 generic/threadSvCmd.c        \
                 generic/threadSpCmd.c        \
                 generic/threadPoolCmd.c      \
                 generic/psGdbm.c             \
                 generic/threadSvListCmd.c    \
                 generic/threadSvKeylistCmd.c \
                 generic/tclXkeylist.c        \
])

TEA_ADD_HEADERS([generic/tclThread.h])
TEA_ADD_INCLUDES([${AOL_INCLUDES}])
TEA_ADD_LIBS([${GDBM_LIBS} ${AOL_LIBS}])
TEA_ADD_CFLAGS([${GDBM_CFLAGS}])
TEA_ADD_STUB_SOURCES([])
TEA_ADD_TCL_SOURCES([lib/ttrace.tcl])

#--------------------------------------------------------------------
# __CHANGE__
# A few miscellaneous platform-specific items:







|
|














|
>










|
|







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Check if building with optional Gdbm package. This will declare
# GDBM_CFLAGS and GDBM_LIBS variables.
#--------------------------------------------------------------------

TCLTHREAD_WITH_GDBM

#--------------------------------------------------------------------
# Locate the NaviServer/AOLserver dir for compilation as NaviServer/AOLserver module.
# This will declare NS_INCLUDES, NS_LIBS and define NS_AOLSERVER.
#--------------------------------------------------------------------

NS_PATH_AOLSERVER

#-----------------------------------------------------------------------
# __CHANGE__
# Specify the C source files to compile in TEA_ADD_SOURCES,
# public headers that need to be installed in TEA_ADD_HEADERS,
# stub library C source files to compile in TEA_ADD_STUB_SOURCES,
# and runtime Tcl library files in TEA_ADD_TCL_SOURCES.
# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS
# and PKG_TCL_SOURCES.
#-----------------------------------------------------------------------

TEA_ADD_SOURCES([generic/threadNs.c           \
                 generic/threadCmd.c          \
                 generic/threadSvCmd.c        \
                 generic/threadSpCmd.c        \
                 generic/threadPoolCmd.c      \
                 generic/psGdbm.c             \
                 generic/threadSvListCmd.c    \
                 generic/threadSvKeylistCmd.c \
                 generic/tclXkeylist.c        \
])

TEA_ADD_HEADERS([generic/tclThread.h])
TEA_ADD_INCLUDES([${NS_INCLUDES}])
TEA_ADD_LIBS([${GDBM_LIBS} ${NS_LIBS}])
TEA_ADD_CFLAGS([${GDBM_CFLAGS}])
TEA_ADD_STUB_SOURCES([])
TEA_ADD_TCL_SOURCES([lib/ttrace.tcl])

#--------------------------------------------------------------------
# __CHANGE__
# A few miscellaneous platform-specific items:

Deleted generic/aolstub.cpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
 * aolstub.cpp --
 *
 * Adds interface for loading the extension into the AOLserver.
 *
 * Copyright (c) 2002 by Zoran Vasiljevic.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * ---------------------------------------------------------------------------
 */

#ifdef NS_AOLSERVER
#include <ns.h>

int Ns_ModuleVersion = 1;

/*
 * Structure to pass to NsThread_Init. This holds the module
 * and virtual server name for proper interp initializations. 
 */

struct mydata {
    char *modname;
    char *server;
};

/*
 *----------------------------------------------------------------------------
 *
 * NsThread_Init --
 *
 *    Loads the package for the first time, i.e. in the startup thread.
 *
 * Results:
 *    Standard Tcl result
 *
 * Side effects:
 *    Package initialized. Tcl commands created.
 *
 *----------------------------------------------------------------------------
 */

static int
NsThread_Init (Tcl_Interp *interp, void *cd)
{
    struct mydata *md = (struct mydata*)cd;
    int ret = Thread_Init(interp);

    if (ret != TCL_OK) {
        Ns_Log(Warning, "can't load module %s: %s", md->modname,
               Tcl_GetStringResult(interp));
        return TCL_ERROR;
    }
    Tcl_SetAssocData(interp, "thread:nsd", NULL, (ClientData)md);

    return TCL_OK;
}

/*
 *----------------------------------------------------------------------------
 *
 * Ns_ModuleInit --
 *
 *    Called by the AOLserver when loading shared object file.
 *
 * Results:
 *    Standard AOLserver result
 *
 * Side effects:
 *    Many. Depends on the package.
 *
 *----------------------------------------------------------------------------
 */

int
Ns_ModuleInit(char *srv, char *mod)
{
    struct mydata *md = NULL;

    md = (struct mydata*)ns_malloc(sizeof(struct mydata));
    md->modname = strcpy(ns_malloc(strlen(mod)+1), mod);
    md->server  = strcpy(ns_malloc(strlen(srv)+1), srv);

    return Ns_TclRegisterTrace(srv, NsThread_Init, (void*)md, NS_TCL_TRACE_CREATE);
}

#endif /* NS_AOLSERVER */

/* EOF $RCSfile: aolstub.cpp,v $ */

/* Emacs Setup Variables */
/* Local Variables:      */
/* mode: C               */
/* indent-tabs-mode: nil */
/* c-basic-offset: 4     */
/* End:                  */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































Changes to generic/tclThreadInt.h.

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#define _TCL_THREAD_INT_H_

#include "tclThread.h"
#include <stdlib.h> /* For strtoul */
#include <string.h> /* For memset and friends */

/*
 * For linking against AOLserver require V4 at least
 */

#ifdef NS_AOLSERVER
# include <ns.h>
# if !defined(NS_MAJOR_VERSION) || NS_MAJOR_VERSION < 4
#  error "unsupported AOLserver version"
# endif
#endif

/*
 * Allow for some command names customization.
 * Only thread:: and tpool:: are handled here.
 * Shared variable commands are more complicated.







|





|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#define _TCL_THREAD_INT_H_

#include "tclThread.h"
#include <stdlib.h> /* For strtoul */
#include <string.h> /* For memset and friends */

/*
 * For linking against NaviServer/AOLserver require V4 at least
 */

#ifdef NS_AOLSERVER
# include <ns.h>
# if !defined(NS_MAJOR_VERSION) || NS_MAJOR_VERSION < 4
#  error "unsupported NaviServer/AOLserver version"
# endif
#endif

/*
 * Allow for some command names customization.
 * Only thread:: and tpool:: are handled here.
 * Shared variable commands are more complicated.
87
88
89
90
91
92
93
94





















95
#define OPT_CMP(a,b) \
  ((a) && (b) && (*(a)==*(b)) && (*(a+1)==*(b+1)) && (!strcmp((a),(b))))

#ifndef TCL_TSD_INIT
#define TCL_TSD_INIT(keyPtr) \
  (ThreadSpecificData*)Tcl_GetThreadData((keyPtr),sizeof(ThreadSpecificData))
#endif






















#endif /* _TCL_THREAD_INT_H_ */








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#define OPT_CMP(a,b) \
  ((a) && (b) && (*(a)==*(b)) && (*(a+1)==*(b+1)) && (!strcmp((a),(b))))

#ifndef TCL_TSD_INIT
#define TCL_TSD_INIT(keyPtr) \
  (ThreadSpecificData*)Tcl_GetThreadData((keyPtr),sizeof(ThreadSpecificData))
#endif

/*
 * Structure to pass to NsThread_Init. This holds the module
 * and virtual server name for proper interp initializations.
 */

typedef struct {
    char *modname;
    char *server;
} NsThreadInterpData;

/*
 * Handle binary compatibility regarding
 * Tcl_GetErrorLine in 8.x
 * See Tcl bug #3562640.
 */
#if (TCL_MAJOR_VERSION == 8)
# undef Tcl_GetErrorLine
# define Tcl_GetErrorLine(interp) ((interp)->errorLine)
#endif


#endif /* _TCL_THREAD_INT_H_ */

Changes to generic/threadCmd.c.

17
18
19
20
21
22
23









24




25







26
27
28
29
30
31
32
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * ----------------------------------------------------------------------------
 */

#include "tclThreadInt.h"










#ifdef NS_AOLSERVER




# include "aolstub.cpp"







#endif

/*
 * Access to the list of threads and to the thread send results
 * (defined below) is guarded by this mutex.
 */








>
>
>
>
>
>
>
>
>
|
>
>
>
>
|
>
>
>
>
>
>
>







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * ----------------------------------------------------------------------------
 */

#include "tclThreadInt.h"

/*
 * Check if this is Tcl 8.5 or higher. In that case, we will have the TIP
 * #143 APIs (i.e. interpreter resource limiting) available.
 */
#define haveInterpLimit (tclVersion>84)
#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 5)
# define Tcl_LimitExceeded ((int (*)(Tcl_Interp *)) \
    ((&(tclStubsPtr->tcl_PkgProvideEx))[524]))
#endif

/*
 * Check if this is Tcl 8.6 or higher.  In that case, we will have the TIP
 * #285 APIs (i.e. asynchronous script cancellation) available.
 */

#define haveInterpCancel (tclVersion>85)
#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 6)
# define TCL_CANCEL_UNWIND 0x100000
# define Tcl_CancelEval ((int (*)(Tcl_Interp *, Tcl_Obj *, ClientData, int)) \
    ((&(tclStubsPtr->tcl_PkgProvideEx))[580]))
# define Tcl_Canceled ((int (*)(Tcl_Interp *, int)) \
    ((&(tclStubsPtr->tcl_PkgProvideEx))[581]))
#endif

/*
 * Access to the list of threads and to the thread send results
 * (defined below) is guarded by this mutex.
 */

81
82
83
84
85
86
87


88
89
90
91
92
93
94
static struct ThreadSpecificData *threadList = NULL;

/*
 * Used to represent the empty result.
 */

static char *threadEmptyResult = (char *)"";



/*
 * An instance of the following structure contains all information that is
 * passed into a new thread when the thread is created using either the
 * "thread create" Tcl command or the ThreadCreate() C function.
 */








>
>







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
static struct ThreadSpecificData *threadList = NULL;

/*
 * Used to represent the empty result.
 */

static char *threadEmptyResult = (char *)"";

static int tclVersion = 0;

/*
 * An instance of the following structure contains all information that is
 * passed into a new thread when the thread is created using either the
 * "thread create" Tcl command or the ThreadCreate() C function.
 */

360
361
362
363
364
365
366
367
368
369
370
371
372
373





374
375
376
377
378
379
380
381
382
383
384
385
386
static Tcl_ObjCmdProc ThreadAttachObjCmd;
static Tcl_ObjCmdProc ThreadCancelObjCmd;

static int
ThreadInit(interp)
    Tcl_Interp *interp; /* The current Tcl interpreter */
{
    int tclIsThreaded = 0;;

    if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
        return TCL_ERROR;
    }

    if (Tcl_Eval(interp, "::tcl::pkgconfig get threaded") != TCL_OK





	    || Tcl_GetBooleanFromObj(interp,
	    Tcl_GetObjResult(interp), &tclIsThreaded) != TCL_OK
	    || !tclIsThreaded) {
	Tcl_SetObjResult(interp, Tcl_NewStringObj(
		"Tcl core wasn't compiled for threading.", -1));
	return TCL_ERROR;
    }

    TCL_CMD(interp, THREAD_CMD_PREFIX"create",    ThreadCreateObjCmd);
    TCL_CMD(interp, THREAD_CMD_PREFIX"send",      ThreadSendObjCmd);
    TCL_CMD(interp, THREAD_CMD_PREFIX"broadcast", ThreadBroadcastObjCmd);
    TCL_CMD(interp, THREAD_CMD_PREFIX"exit",      ThreadExitObjCmd);
    TCL_CMD(interp, THREAD_CMD_PREFIX"unwind",    ThreadUnwindObjCmd);







<
<
|



|
>
>
>
>
>
|
|
|
<
<
<







382
383
384
385
386
387
388


389
390
391
392
393
394
395
396
397
398
399
400
401



402
403
404
405
406
407
408
static Tcl_ObjCmdProc ThreadAttachObjCmd;
static Tcl_ObjCmdProc ThreadCancelObjCmd;

static int
ThreadInit(interp)
    Tcl_Interp *interp; /* The current Tcl interpreter */
{


    if (Tcl_InitStubs(interp, "8.4", 0) == NULL) {
        return TCL_ERROR;
    }

    if (!tclVersion) {
	/*
	 * Perform a version check now to stop using from trying to use
	 * the TIP #143 or TIP #285 functionality if they are not present.
	 */
	int major, minor;

	Tcl_GetVersion(&major, &minor, NULL, NULL);
	tclVersion = 10 * major + minor;



    }

    TCL_CMD(interp, THREAD_CMD_PREFIX"create",    ThreadCreateObjCmd);
    TCL_CMD(interp, THREAD_CMD_PREFIX"send",      ThreadSendObjCmd);
    TCL_CMD(interp, THREAD_CMD_PREFIX"broadcast", ThreadBroadcastObjCmd);
    TCL_CMD(interp, THREAD_CMD_PREFIX"exit",      ThreadExitObjCmd);
    TCL_CMD(interp, THREAD_CMD_PREFIX"unwind",    ThreadUnwindObjCmd);
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
    int         flags;          /* Zero for no flags */
    int         preserve;       /* If true, reserve the thread */
{
    char thrHandle[THREAD_HNDLMAXLEN];
    ThreadCtrl ctrl;
    Tcl_ThreadId thrId;

#ifdef NS_AOLSERVER
    ctrl.cd = Tcl_GetAssocData(interp, "thread:nsd", NULL);
#endif
    ctrl.script   = (char *)script;
    ctrl.condWait = NULL;
    ctrl.flags    = 0;

    Tcl_MutexLock(&threadMutex);
    if (Tcl_CreateThread(&thrId, NewThread, (ClientData)&ctrl,
            stacksize, flags) != TCL_OK) {







<

<







1619
1620
1621
1622
1623
1624
1625

1626

1627
1628
1629
1630
1631
1632
1633
    int         flags;          /* Zero for no flags */
    int         preserve;       /* If true, reserve the thread */
{
    char thrHandle[THREAD_HNDLMAXLEN];
    ThreadCtrl ctrl;
    Tcl_ThreadId thrId;


    ctrl.cd = Tcl_GetAssocData(interp, "thread:nsd", NULL);

    ctrl.script   = (char *)script;
    ctrl.condWait = NULL;
    ctrl.flags    = 0;

    Tcl_MutexLock(&threadMutex);
    if (Tcl_CreateThread(&thrId, NewThread, (ClientData)&ctrl,
            stacksize, flags) != TCL_OK) {
2125
2126
2127
2128
2129
2130
2131





2132
2133
2134
2135
2136
2137
2138
    if (tsdPtr == (ThreadSpecificData*)NULL) {
        Tcl_MutexUnlock(&threadMutex);
        ErrorNoSuchThread(interp, thrId);
        return TCL_ERROR;
    }

    Tcl_MutexUnlock(&threadMutex);






    return Tcl_CancelEval(tsdPtr->interp,
            (result != NULL) ? Tcl_NewStringObj(result, -1) : NULL, 0, flags);
}

/*
 *----------------------------------------------------------------------







>
>
>
>
>







2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
    if (tsdPtr == (ThreadSpecificData*)NULL) {
        Tcl_MutexUnlock(&threadMutex);
        ErrorNoSuchThread(interp, thrId);
        return TCL_ERROR;
    }

    Tcl_MutexUnlock(&threadMutex);

    if (!haveInterpCancel) {
	Tcl_AppendResult(interp, "not supported with this Tcl version", NULL);
	return TCL_ERROR;
    }

    return Tcl_CancelEval(tsdPtr->interp,
            (result != NULL) ? Tcl_NewStringObj(result, -1) : NULL, 0, flags);
}

/*
 *----------------------------------------------------------------------
2742
2743
2744
2745
2746
2747
2748

2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764

2765
2766
2767

2768
2769
2770
2771
2772
2773
2774
         * a script in progress to be canceled or exceed its limit;
         * therefore, check for these conditions if we are able to
         * (i.e. we are running in a high enough version of Tcl).
         */

        Tcl_DoOneEvent(TCL_ALL_EVENTS);


        /*
         * If the script has been unwound, bail out immediately. This does
         * not follow the recommended guidelines for how extensions should
         * handle the script cancellation functionality because this is
         * not a "normal" extension. Most extensions do not have a command
         * that simply enters an infinite Tcl event loop. Normal extensions
         * should not specify the TCL_CANCEL_UNWIND when calling the
         * Tcl_Canceled function to check if the command has been canceled.
         */

        if (Tcl_Canceled(tsdPtr->interp,
                TCL_LEAVE_ERR_MSG | TCL_CANCEL_UNWIND) == TCL_ERROR) {
            code = TCL_ERROR;
            break;
        }


        if (Tcl_LimitExceeded(tsdPtr->interp)) {
            code = TCL_ERROR;
            break;

        }

        /*
         * Test stop condition under mutex since
         * some other thread may flip our flags.
         */








>
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
>
|
|
|
>







2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
         * a script in progress to be canceled or exceed its limit;
         * therefore, check for these conditions if we are able to
         * (i.e. we are running in a high enough version of Tcl).
         */

        Tcl_DoOneEvent(TCL_ALL_EVENTS);

        if (haveInterpCancel) {
            /*
             * If the script has been unwound, bail out immediately. This does
             * not follow the recommended guidelines for how extensions should
             * handle the script cancellation functionality because this is
             * not a "normal" extension. Most extensions do not have a command
             * that simply enters an infinite Tcl event loop. Normal extensions
             * should not specify the TCL_CANCEL_UNWIND when calling the
             * Tcl_Canceled function to check if the command has been canceled.
             */

            if (Tcl_Canceled(tsdPtr->interp,
                    TCL_LEAVE_ERR_MSG | TCL_CANCEL_UNWIND) == TCL_ERROR) {
                code = TCL_ERROR;
                break;
            }
        }
        if (haveInterpLimit) {
            if (Tcl_LimitExceeded(tsdPtr->interp)) {
                code = TCL_ERROR;
                break;
            }
        }

        /*
         * Test stop condition under mutex since
         * some other thread may flip our flags.
         */

3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
    if (threadEvalScript && threadEvalScript != threadEmptyResult) {
        Tcl_Free((char*)threadEvalScript);
    }

    Tcl_MutexLock(&threadMutex);

    /*
     * AOLserver and threadpool threads get started/stopped
     * out of the control of this interface so this is
     * the first chance to split them out of the thread list.
     */

    ListRemoveInner(tsdPtr);

    /*







|







3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
    if (threadEvalScript && threadEvalScript != threadEmptyResult) {
        Tcl_Free((char*)threadEvalScript);
    }

    Tcl_MutexLock(&threadMutex);

    /*
     * NaviServer/AOLserver and threadpool threads get started/stopped
     * out of the control of this interface so this is
     * the first chance to split them out of the thread list.
     */

    ListRemoveInner(tsdPtr);

    /*

Added generic/threadNs.c.

















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
 * aolstub.cpp --
 *
 * Adds interface for loading the extension into the NaviServer/AOLserver.
 *
 * Copyright (c) 2002 by Zoran Vasiljevic.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * ---------------------------------------------------------------------------
 */

#ifdef NS_AOLSERVER
#include <ns.h>
#include "tclThreadInt.h"

int Ns_ModuleVersion = 1;

/*
 *----------------------------------------------------------------------------
 *
 * NsThread_Init --
 *
 *    Loads the package for the first time, i.e. in the startup thread.
 *
 * Results:
 *    Standard Tcl result
 *
 * Side effects:
 *    Package initialized. Tcl commands created.
 *
 *----------------------------------------------------------------------------
 */

static int
NsThread_Init (Tcl_Interp *interp, void *cd)
{
    NsThreadInterpData *md = (NsThreadInterpData*)cd;
    int ret = Thread_Init(interp);

    if (ret != TCL_OK) {
        Ns_Log(Warning, "can't load module %s: %s", md->modname,
               Tcl_GetStringResult(interp));
        return TCL_ERROR;
    }
    Tcl_SetAssocData(interp, "thread:nsd", NULL, (ClientData)md);

    return TCL_OK;
}

/*
 *----------------------------------------------------------------------------
 *
 * Ns_ModuleInit --
 *
 *    Called by the NaviServer/AOLserver when loading shared object file.
 *
 * Results:
 *    Standard NaviServer/AOLserver result
 *
 * Side effects:
 *    Many. Depends on the package.
 *
 *----------------------------------------------------------------------------
 */

int
Ns_ModuleInit(char *srv, char *mod)
{
    NsThreadInterpData *md = NULL;

    md = (NsThreadInterpData*)ns_malloc(sizeof(NsThreadInterpData));
    md->modname = strcpy(ns_malloc(strlen(mod)+1), mod);
    md->server  = strcpy(ns_malloc(strlen(srv)+1), srv);

    return Ns_TclRegisterTrace(srv, NsThread_Init, (void*)md, NS_TCL_TRACE_CREATE);
}

#endif /* NS_AOLSERVER */

/* EOF $RCSfile: aolstub.cpp,v $ */

/* Emacs Setup Variables */
/* Local Variables:      */
/* mode: C               */
/* indent-tabs-mode: nil */
/* c-basic-offset: 4     */
/* End:                  */

Changes to generic/threadSvCmd.c.

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "tclThreadInt.h"
#include "threadSvCmd.h"

#include "threadSvListCmd.h"    /* Shared variants of list commands */
#include "threadSvKeylistCmd.h" /* Shared variants of list commands */
#include "psGdbm.h"             /* The gdbm persistent store implementation */

#ifdef NS_AOLSERVER
# define HIDE_DOTNAMES       /* tsv::names cmd does not list .<name> arrays */
#endif

/*
 * Number of buckets to spread shared arrays into. Each bucket is
 * associated with one mutex so locking a bucket locks all arrays
 * in that bucket as well. The number of buckets should be a prime.
 */

#define NUMBUCKETS 31







<
<
<
<







16
17
18
19
20
21
22




23
24
25
26
27
28
29
#include "tclThreadInt.h"
#include "threadSvCmd.h"

#include "threadSvListCmd.h"    /* Shared variants of list commands */
#include "threadSvKeylistCmd.h" /* Shared variants of list commands */
#include "psGdbm.h"             /* The gdbm persistent store implementation */





/*
 * Number of buckets to spread shared arrays into. Each bucket is
 * associated with one mutex so locking a bucket locks all arrays
 * in that bucket as well. The number of buckets should be a prime.
 */

#define NUMBUCKETS 31
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
static RegType*   regType;      /* Linked list of registered obj types */
static PsStore*   psStore;      /* Linked list of registered pers. stores */

static Tcl_Mutex  svMutex;      /* Protects inserts into above lists */
static Tcl_Mutex  initMutex;    /* Serializes initialization issues */

/*
 * The standard commands found in AOLserver nsv_* interface.
 * For sharp-eye readers: the implementaion of the "lappend" command
 * is moved to new list-command package, since it realy belongs there.
 */

static Tcl_ObjCmdProc SvObjObjCmd;
static Tcl_ObjCmdProc SvAppendObjCmd;
static Tcl_ObjCmdProc SvIncrObjCmd;
static Tcl_ObjCmdProc SvSetObjCmd;
static Tcl_ObjCmdProc SvExistsObjCmd;







|
|
|







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
static RegType*   regType;      /* Linked list of registered obj types */
static PsStore*   psStore;      /* Linked list of registered pers. stores */

static Tcl_Mutex  svMutex;      /* Protects inserts into above lists */
static Tcl_Mutex  initMutex;    /* Serializes initialization issues */

/*
 * The standard commands found in NaviServer/AOLserver nsv_* interface.
 * For sharp-eye readers: the implementation of the "lappend" command
 * is moved to new list-command package, since it really belongs there.
 */

static Tcl_ObjCmdProc SvObjObjCmd;
static Tcl_ObjCmdProc SvAppendObjCmd;
static Tcl_ObjCmdProc SvIncrObjCmd;
static Tcl_ObjCmdProc SvSetObjCmd;
static Tcl_ObjCmdProc SvExistsObjCmd;
140
141
142
143
144
145
146
147
148
149
150
151
152
153

154
155
156
157
158
159
160

161
162
163
164
165
166
167
168
169
170
171
172
173
174


175
176
177
178
179
180
181
 * Side effects;
 *      New command will be added to a linked list of registered commands.
 *
 *-----------------------------------------------------------------------------
 */

void
Sv_RegisterCommand(cmdName, objProc, delProc, clientData)
    const char *cmdName;                /* Name of command to register */
    Tcl_ObjCmdProc *objProc;            /* Object-based command procedure */
    Tcl_CmdDeleteProc *delProc;         /* Command delete procedure */
    ClientData clientData;              /* Private data ptr to pass to cmd */
{
    int len = strlen(cmdName) + strlen(TSV_CMD_PREFIX);

    SvCmdInfo *newCmd = (SvCmdInfo*)Tcl_Alloc(sizeof(SvCmdInfo) + len + 1);

    /*
     * Setup new command structure
     */

    newCmd->cmdName = (char*)((char*)newCmd + sizeof(SvCmdInfo));


    newCmd->objProcPtr = objProc;
    newCmd->delProcPtr = delProc;
    newCmd->clientData = clientData;

    /*
     * Rewrite command name. This is needed so we can
     * easily turn-on the compatiblity with AOLserver
     * command names.
     */

    strcpy(newCmd->cmdName, TSV_CMD_PREFIX);
    strcat(newCmd->cmdName, cmdName);
    newCmd->name = newCmd->cmdName + strlen(TSV_CMD_PREFIX);



    /*
     * Plug-in in shared list of commands.
     */

    Tcl_MutexLock(&svMutex);
    if (svCmdInfo == NULL) {







|



<

|
>
|






>



<



|






>
>







136
137
138
139
140
141
142
143
144
145
146

147
148
149
150
151
152
153
154
155
156
157
158
159
160

161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
 * Side effects;
 *      New command will be added to a linked list of registered commands.
 *
 *-----------------------------------------------------------------------------
 */

void
Sv_RegisterCommand(cmdName, objProc, delProc)
    const char *cmdName;                /* Name of command to register */
    Tcl_ObjCmdProc *objProc;            /* Object-based command procedure */
    Tcl_CmdDeleteProc *delProc;         /* Command delete procedure */

{
    int len = strlen(cmdName) + strlen(TSV_CMD_PREFIX) + 1;
    int len2 = strlen(cmdName) + strlen(TSV_CMD2_PREFIX) + 1;
    SvCmdInfo *newCmd = (SvCmdInfo*)Tcl_Alloc(sizeof(SvCmdInfo) + len + len2);

    /*
     * Setup new command structure
     */

    newCmd->cmdName = (char*)((char*)newCmd + sizeof(SvCmdInfo));
    newCmd->cmdName2 = newCmd->cmdName + len;

    newCmd->objProcPtr = objProc;
    newCmd->delProcPtr = delProc;


    /*
     * Rewrite command name. This is needed so we can
     * easily turn-on the compatiblity with NaviServer/AOLserver
     * command names.
     */

    strcpy(newCmd->cmdName, TSV_CMD_PREFIX);
    strcat(newCmd->cmdName, cmdName);
    newCmd->name = newCmd->cmdName + strlen(TSV_CMD_PREFIX);
    strcpy(newCmd->cmdName2, TSV_CMD2_PREFIX);
    strcat(newCmd->cmdName2, cmdName);

    /*
     * Plug-in in shared list of commands.
     */

    Tcl_MutexLock(&svMutex);
    if (svCmdInfo == NULL) {
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
 * Side effects:
 *      New Tcl command gets created.
 *
 *-----------------------------------------------------------------------------
 */

static int
SvObjObjCmd(dummy, interp, objc, objv)
    ClientData dummy;                   /* Not used. */
    Tcl_Interp *interp;                 /* Current interpreter. */
    int objc;                           /* Number of arguments. */
    Tcl_Obj *const objv[];              /* Argument objects. */
{
    int new, off, ret, flg;
    char buf[128];
    Tcl_Obj *val = NULL;







|
|







1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
 * Side effects:
 *      New Tcl command gets created.
 *
 *-----------------------------------------------------------------------------
 */

static int
SvObjObjCmd(arg, interp, objc, objv)
    ClientData arg;                     /* Just passed to subcommands. */
    Tcl_Interp *interp;                 /* Current interpreter. */
    int objc;                           /* Number of arguments. */
    Tcl_Obj *const objv[];              /* Argument objects. */
{
    int new, off, ret, flg;
    char buf[128];
    Tcl_Obj *val = NULL;
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
    }

    /*
     * Format the command name
     */

    sprintf(buf, "::%p", (int*)svObj);
    Tcl_CreateObjCommand(interp, buf, SvObjDispatchObjCmd, (int*)svObj, NULL);
    Tcl_ResetResult(interp);
    Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1));

    return Sv_PutContainer(interp, svObj, SV_UNCHANGED);
}

/*







|







1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
    }

    /*
     * Format the command name
     */

    sprintf(buf, "::%p", (int*)svObj);
    Tcl_CreateObjCommand(interp, buf, SvObjDispatchObjCmd, (int*)svObj, arg);
    Tcl_ResetResult(interp);
    Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1));

    return Sv_PutContainer(interp, svObj, SV_UNCHANGED);
}

/*
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
 * Side effects:
 *      See the user documentation.
 *
 *-----------------------------------------------------------------------------
 */

static int
SvNamesObjCmd(dummy, interp, objc, objv)
    ClientData dummy;                   /* Not used. */
    Tcl_Interp *interp;                 /* Current interpreter. */
    int objc;                           /* Number of arguments. */
    Tcl_Obj *const objv[];              /* Argument objects. */
{
    int i, len;
    const char *pattern = NULL;
    Tcl_HashEntry *hPtr;







|
|







1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
 * Side effects:
 *      See the user documentation.
 *
 *-----------------------------------------------------------------------------
 */

static int
SvNamesObjCmd(aol, interp, objc, objv)
    ClientData aol;                     /* !=0 when running in AOL */
    Tcl_Interp *interp;                 /* Current interpreter. */
    int objc;                           /* Number of arguments. */
    Tcl_Obj *const objv[];              /* Argument objects. */
{
    int i, len;
    const char *pattern = NULL;
    Tcl_HashEntry *hPtr;
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520

    for (i = 0; i < NUMBUCKETS; i++) {
        Bucket *bucketPtr = &buckets[i];
        LOCK_BUCKET(bucketPtr);
        hPtr = Tcl_FirstHashEntry(&bucketPtr->arrays, &search);
        while (hPtr) {
            char *key = Tcl_GetHashKey(&bucketPtr->arrays, hPtr);
#ifdef HIDE_DOTNAMES
            if (*key != '.' /* Hide .<name> arrays */ &&
#else
            if (1 &&
#endif
                (pattern == NULL || Tcl_StringMatch(key, pattern))) {
                Tcl_ListObjAppendElement(interp, resObj,
                        Tcl_NewStringObj(key, -1));
            }
            hPtr = Tcl_NextHashEntry(&search);
        }
        UNLOCK_BUCKET(bucketPtr);







<
|
<
<
<







1500
1501
1502
1503
1504
1505
1506

1507



1508
1509
1510
1511
1512
1513
1514

    for (i = 0; i < NUMBUCKETS; i++) {
        Bucket *bucketPtr = &buckets[i];
        LOCK_BUCKET(bucketPtr);
        hPtr = Tcl_FirstHashEntry(&bucketPtr->arrays, &search);
        while (hPtr) {
            char *key = Tcl_GetHashKey(&bucketPtr->arrays, hPtr);

            if ((!aol || (*key != '.')) /* Hide .<name> arrays for AOL*/ &&



                (pattern == NULL || Tcl_StringMatch(key, pattern))) {
                Tcl_ListObjAppendElement(interp, resObj,
                        Tcl_NewStringObj(key, -1));
            }
            hPtr = Tcl_NextHashEntry(&search);
        }
        UNLOCK_BUCKET(bucketPtr);
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
SvRegisterStdCommands(void)
{
    static int initialized = 0;

    if (initialized == 0) {
        Tcl_MutexLock(&initMutex);
        if (initialized == 0) {
            Sv_RegisterCommand("var",    SvObjObjCmd,    NULL, NULL);
            Sv_RegisterCommand("object", SvObjObjCmd,    NULL, NULL);
            Sv_RegisterCommand("set",    SvSetObjCmd,    NULL, NULL);
            Sv_RegisterCommand("unset",  SvUnsetObjCmd,  NULL, NULL);
            Sv_RegisterCommand("get",    SvGetObjCmd,    NULL, NULL);
            Sv_RegisterCommand("incr",   SvIncrObjCmd,   NULL, NULL);
            Sv_RegisterCommand("exists", SvExistsObjCmd, NULL, NULL);
            Sv_RegisterCommand("append", SvAppendObjCmd, NULL, NULL);
            Sv_RegisterCommand("array",  SvArrayObjCmd,  NULL, NULL);
            Sv_RegisterCommand("names",  SvNamesObjCmd,  NULL, NULL);
            Sv_RegisterCommand("pop",    SvPopObjCmd,    NULL, NULL);
            Sv_RegisterCommand("move",   SvMoveObjCmd,   NULL, NULL);
            Sv_RegisterCommand("lock",   SvLockObjCmd,   NULL, NULL);
            initialized = 1;
        }
        Tcl_MutexUnlock(&initMutex);
    }
}

/*







|
|
|
|
|
|
|
|
|
|
|
|
|







2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
SvRegisterStdCommands(void)
{
    static int initialized = 0;

    if (initialized == 0) {
        Tcl_MutexLock(&initMutex);
        if (initialized == 0) {
            Sv_RegisterCommand("var",    SvObjObjCmd,    NULL);
            Sv_RegisterCommand("object", SvObjObjCmd,    NULL);
            Sv_RegisterCommand("set",    SvSetObjCmd,    NULL);
            Sv_RegisterCommand("unset",  SvUnsetObjCmd,  NULL);
            Sv_RegisterCommand("get",    SvGetObjCmd,    NULL);
            Sv_RegisterCommand("incr",   SvIncrObjCmd,   NULL);
            Sv_RegisterCommand("exists", SvExistsObjCmd, NULL);
            Sv_RegisterCommand("append", SvAppendObjCmd, NULL);
            Sv_RegisterCommand("array",  SvArrayObjCmd,  NULL);
            Sv_RegisterCommand("names",  SvNamesObjCmd,  NULL);
            Sv_RegisterCommand("pop",    SvPopObjCmd,    NULL);
            Sv_RegisterCommand("move",   SvMoveObjCmd,   NULL);
            Sv_RegisterCommand("lock",   SvLockObjCmd,   NULL);
            initialized = 1;
        }
        Tcl_MutexUnlock(&initMutex);
    }
}

/*
2163
2164
2165
2166
2167
2168
2169
2170




2171
2172
2173
2174
2175
2176
2177

    /*
     * Plug-in registered commands in current interpreter
     */

    for (cmdPtr = svCmdInfo; cmdPtr; cmdPtr = cmdPtr->nextPtr) {
        Tcl_CreateObjCommand(interp, cmdPtr->cmdName, cmdPtr->objProcPtr,
                (ClientData)cmdPtr->clientData, (Tcl_CmdDeleteProc*)0);




    }

    /*
     * Create array of buckets and initialize each bucket
     */

    if (buckets == NULL) {







|
>
>
>
>







2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175

    /*
     * Plug-in registered commands in current interpreter
     */

    for (cmdPtr = svCmdInfo; cmdPtr; cmdPtr = cmdPtr->nextPtr) {
        Tcl_CreateObjCommand(interp, cmdPtr->cmdName, cmdPtr->objProcPtr,
                (ClientData)0, (Tcl_CmdDeleteProc*)0);
#ifdef NS_AOLSERVER
        Tcl_CreateObjCommand(interp, cmdPtr->cmdName2, cmdPtr->objProcPtr,
                (ClientData)1, (Tcl_CmdDeleteProc*)0);
#endif
    }

    /*
     * Create array of buckets and initialize each bucket
     */

    if (buckets == NULL) {

Changes to generic/threadSvCmd.h.

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
 * compatibility with AOLserver nsv_* commands
 */

/* #define NSV_COMPAT 1 */

/*
 * Uncomment following line to force command-line
 * compatibility with older thread::sv_ commands
 * If you leave it commented-out, the older style
 * command is going to be included in addition to
 * the new tsv::* style.
 */

/* #define OLD_COMPAT 1 */

#ifdef NS_AOLSERVER
# ifdef NSV_COMPAT
#  define TSV_CMD_PREFIX "nsv_"  /* Compatiblity prefix for AOLserver */
# else
#  define TSV_CMD_PREFIX "sv_"   /* Regular command prefix for AOLserver */
# endif
#else
# ifdef OLD_COMPAT
#  define TSV_CMD_PREFIX "thread::sv_" /* Old command prefix for Tcl */
# else
#  define TSV_CMD_PREFIX "tsv::" /* Regular command prefix for Tcl */
# endif
#endif

/*
 * Used when creating arrays/variables
 */

#define FLAGS_CREATEARRAY  1   /* Create the array in bucket if none found */







|
<
<
<




<
|
|
|
|
|
<
|
|
|
|
<







23
24
25
26
27
28
29
30



31
32
33
34

35
36
37
38
39

40
41
42
43

44
45
46
47
48
49
50
 * compatibility with AOLserver nsv_* commands
 */

/* #define NSV_COMPAT 1 */

/*
 * Uncomment following line to force command-line
 * compatibility with older thread::sv_ commands.



 */

/* #define OLD_COMPAT 1 */


#ifdef NSV_COMPAT
# define TSV_CMD2_PREFIX "nsv_"  /* Compatiblity prefix for NaviServer/AOLserver */
#else
# define TSV_CMD2_PREFIX "sv_"   /* Regular command prefix for NaviServer/AOLserver */
#endif

#ifdef OLD_COMPAT
# define TSV_CMD_PREFIX "thread::sv_" /* Old command prefix for Tcl */
#else
# define TSV_CMD_PREFIX "tsv::" /* Regular command prefix for Tcl */

#endif

/*
 * Used when creating arrays/variables
 */

#define FLAGS_CREATEARRAY  1   /* Create the array in bucket if none found */
163
164
165
166
167
168
169

170
171
172
173
174
175
176
177
178
179
/*
 * Structure for generating command names in Tcl
 */

typedef struct SvCmdInfo {
    char *name;                 /* The short name of the command */
    char *cmdName;              /* Real (rewritten) name of the command */

    Tcl_ObjCmdProc *objProcPtr; /* The object-based command procedure */
    Tcl_CmdDeleteProc *delProcPtr; /* Pointer to command delete function */
    ClientData *clientData;     /* Pointer passed to above command */
    struct SvCmdInfo *nextPtr;  /* Next in chain of registered commands */
} SvCmdInfo;

/*
 * Structure for registering special object duplicator functions.
 * Reason for this is that even some regular Tcl duplicators
 * produce shallow instead of proper deep copies of the object.







>


<







157
158
159
160
161
162
163
164
165
166

167
168
169
170
171
172
173
/*
 * Structure for generating command names in Tcl
 */

typedef struct SvCmdInfo {
    char *name;                 /* The short name of the command */
    char *cmdName;              /* Real (rewritten) name of the command */
    char *cmdName2;             /* Real AOL (rewritten) name of the command */
    Tcl_ObjCmdProc *objProcPtr; /* The object-based command procedure */
    Tcl_CmdDeleteProc *delProcPtr; /* Pointer to command delete function */

    struct SvCmdInfo *nextPtr;  /* Next in chain of registered commands */
} SvCmdInfo;

/*
 * Structure for registering special object duplicator functions.
 * Reason for this is that even some regular Tcl duplicators
 * produce shallow instead of proper deep copies of the object.
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
} RegType;

/*
 * Limited API functions
 */

MODULE_SCOPE void
Sv_RegisterCommand(const char*,Tcl_ObjCmdProc*,Tcl_CmdDeleteProc*,ClientData);

MODULE_SCOPE void
Sv_RegisterObjType(const Tcl_ObjType*, Tcl_DupInternalRepProc*);

MODULE_SCOPE void
Sv_RegisterPsStore(PsStore*);








|







185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
} RegType;

/*
 * Limited API functions
 */

MODULE_SCOPE void
Sv_RegisterCommand(const char*,Tcl_ObjCmdProc*,Tcl_CmdDeleteProc*);

MODULE_SCOPE void
Sv_RegisterObjType(const Tcl_ObjType*, Tcl_DupInternalRepProc*);

MODULE_SCOPE void
Sv_RegisterPsStore(PsStore*);

Changes to generic/threadSvKeylistCmd.c.

64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Sv_RegisterKeylistCommands(void)
{
    static int initialized;

    if (initialized == 0) {
        Tcl_MutexLock(&initMutex);
        if (initialized == 0) {
            Sv_RegisterCommand("keylset",  SvKeylsetObjCmd,  NULL, NULL);
            Sv_RegisterCommand("keylget",  SvKeylgetObjCmd,  NULL, NULL);
            Sv_RegisterCommand("keyldel",  SvKeyldelObjCmd,  NULL, NULL);
            Sv_RegisterCommand("keylkeys", SvKeylkeysObjCmd, NULL, NULL);
            Sv_RegisterObjType(&keyedListType, DupKeyedListInternalRepShared);
            initialized = 1;
        }
        Tcl_MutexUnlock(&initMutex);
    }
}








|
|
|
|







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Sv_RegisterKeylistCommands(void)
{
    static int initialized;

    if (initialized == 0) {
        Tcl_MutexLock(&initMutex);
        if (initialized == 0) {
            Sv_RegisterCommand("keylset",  SvKeylsetObjCmd,  NULL);
            Sv_RegisterCommand("keylget",  SvKeylgetObjCmd,  NULL);
            Sv_RegisterCommand("keyldel",  SvKeyldelObjCmd,  NULL);
            Sv_RegisterCommand("keylkeys", SvKeylkeysObjCmd, NULL);
            Sv_RegisterObjType(&keyedListType, DupKeyedListInternalRepShared);
            initialized = 1;
        }
        Tcl_MutexUnlock(&initMutex);
    }
}


Changes to generic/threadSvListCmd.c.

88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
Sv_RegisterListCommands(void)
{
    static int initialized = 0;

    if (initialized == 0) {
        Tcl_MutexLock(&initMutex);
        if (initialized == 0) {
            Sv_RegisterCommand("lpop",     SvLpopObjCmd,     NULL, NULL);
            Sv_RegisterCommand("lpush",    SvLpushObjCmd,    NULL, NULL);
            Sv_RegisterCommand("lappend",  SvLappendObjCmd,  NULL, NULL);
            Sv_RegisterCommand("lreplace", SvLreplaceObjCmd, NULL, NULL);
            Sv_RegisterCommand("linsert",  SvLinsertObjCmd,  NULL, NULL);
            Sv_RegisterCommand("llength",  SvLlengthObjCmd,  NULL, NULL);
            Sv_RegisterCommand("lindex",   SvLindexObjCmd,   NULL, NULL);
            Sv_RegisterCommand("lrange",   SvLrangeObjCmd,   NULL, NULL);
            Sv_RegisterCommand("lsearch",  SvLsearchObjCmd,  NULL, NULL);
            Sv_RegisterCommand("lset",     SvLsetObjCmd,     NULL, NULL);
            Sv_RegisterObjType(Tcl_GetObjType("list"), DupListObjShared);
            initialized = 1;
        }
        Tcl_MutexUnlock(&initMutex);
    }
}








|
|
|
|
|
|
|
|
|
|







88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
Sv_RegisterListCommands(void)
{
    static int initialized = 0;

    if (initialized == 0) {
        Tcl_MutexLock(&initMutex);
        if (initialized == 0) {
            Sv_RegisterCommand("lpop",     SvLpopObjCmd,     NULL);
            Sv_RegisterCommand("lpush",    SvLpushObjCmd,    NULL);
            Sv_RegisterCommand("lappend",  SvLappendObjCmd,  NULL);
            Sv_RegisterCommand("lreplace", SvLreplaceObjCmd, NULL);
            Sv_RegisterCommand("linsert",  SvLinsertObjCmd,  NULL);
            Sv_RegisterCommand("llength",  SvLlengthObjCmd,  NULL);
            Sv_RegisterCommand("lindex",   SvLindexObjCmd,   NULL);
            Sv_RegisterCommand("lrange",   SvLrangeObjCmd,   NULL);
            Sv_RegisterCommand("lsearch",  SvLsearchObjCmd,  NULL);
            Sv_RegisterCommand("lset",     SvLsetObjCmd,     NULL);
            Sv_RegisterObjType(Tcl_GetObjType("list"), DupListObjShared);
            initialized = 1;
        }
        Tcl_MutexUnlock(&initMutex);
    }
}


Changes to lib/ttrace.tcl.

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
        interp alias {} [namespace current]::_array   {} tsv::array
        interp alias {} [namespace current]::_incr    {} tsv::incr
        interp alias {} [namespace current]::_lappend {} tsv::lappend
        interp alias {} [namespace current]::_names   {} tsv::names
        interp alias {} [namespace current]::_set     {} tsv::set
        interp alias {} [namespace current]::_unset   {} tsv::unset
    } else {
        error "requires AOLserver or Tcl threading extension"
    }

    # Keep in sync with the Thread package
    package provide Ttrace 2.7b1

    # Package variables
    variable resolvers ""     ; # List of registered resolvers
    variable tracers   ""     ; # List of registered cmd tracers
    variable scripts   ""     ; # List of registered script makers
    variable enables   ""     ; # List of trace-enable callbacks
    variable disables  ""     ; # List of trace-disable callbacks







|



|







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
        interp alias {} [namespace current]::_array   {} tsv::array
        interp alias {} [namespace current]::_incr    {} tsv::incr
        interp alias {} [namespace current]::_lappend {} tsv::lappend
        interp alias {} [namespace current]::_names   {} tsv::names
        interp alias {} [namespace current]::_set     {} tsv::set
        interp alias {} [namespace current]::_unset   {} tsv::unset
    } else {
        error "requires NaviServer/AOLserver or Tcl threading extension"
    }

    # Keep in sync with the Thread package
    package provide Ttrace 2.7.0

    # Package variables
    variable resolvers ""     ; # List of registered resolvers
    variable tracers   ""     ; # List of registered cmd tracers
    variable scripts   ""     ; # List of registered script makers
    variable enables   ""     ; # List of trace-enable callbacks
    variable disables  ""     ; # List of trace-disable callbacks

Added naviserver.m4.



















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

#------------------------------------------------------------------------
# NS_PATH_AOLSERVER
#
#   Allows the building with support for NaviServer/AOLserver
#
# Arguments:
#   none
#
# Results:
#
#   Adds the following arguments to configure:
#       --with-naviserver=...
#
#   Defines the following vars:
#       NS_DIR Full path to the directory containing NaviServer/AOLserver distro
#       NS_INCLUDES
#       NS_LIBS
#
#   Sets the following vars:
#       NS_AOLSERVER
#
#   Updates following vars:
#------------------------------------------------------------------------

AC_DEFUN(NS_PATH_AOLSERVER, [
    AC_MSG_CHECKING([for NaviServer/AOLserver configuration])
    AC_ARG_WITH(naviserver,
    [  --with-naviserver       directory with NaviServer/AOLserver distribution],\
    with_naviserver=${withval})

    AC_CACHE_VAL(ac_cv_c_naviserver,[
    if test x"${with_naviserver}" != x ; then
        if test -f "${with_naviserver}/include/ns.h" ; then
            ac_cv_c_naviserver=`(cd ${with_naviserver}; pwd)`
        else
            AC_MSG_ERROR([${with_naviserver} directory doesn't contain ns.h])
        fi
    fi
    ])
    if test x"${ac_cv_c_naviserver}" = x ; then
        AC_MSG_RESULT([none found])
    else
        NS_DIR=${ac_cv_c_naviserver}
        AC_MSG_RESULT([found NaviServer/AOLserver in $NS_DIR])
        NS_INCLUDES="-I\"${NS_DIR}/include\""
        if test "`uname -s`" = Darwin ; then
            aollibs=`ls ${NS_DIR}/lib/libns* 2>/dev/null`
            if test x"$aollibs" != x ; then
                NS_LIBS="-L\"${NS_DIR}/lib\" -lnsd -lnsthread"
            fi
        fi
        AC_DEFINE(NS_AOLSERVER)
    fi
])

# EOF

Changes to pkgIndex.tcl.in.

1
2
3
4
5


6
7


8
9
10
11
12
13
14
15
16
17
18
19
20
21


























# -*- tcl -*-
# Tcl package index file, version 1.1
#
if {![package vsatisfies [package provide Tcl] @TCL_VERSION@]} return
if {![::tcl::pkgconfig get threaded]} return



    package ifneeded Thread @PACKAGE_VERSION@ [list load [file join $dir @PKG_LIB_FILE@]]



	package ifneeded Ttrace @PACKAGE_VERSION@ [list ::apply {{dir} {
	    if {[info exists ::env(TCL_THREAD_LIBRARY)] &&
		[file readable $::env(TCL_THREAD_LIBRARY)/ttrace.tcl]} {
		source $::env(TCL_THREAD_LIBRARY)/ttrace.tcl
	    } elseif {[file readable [file join $dir .. lib ttrace.tcl]]} {
		source [file join $dir .. lib ttrace.tcl]
	    } elseif {[file readable [file join $dir ttrace.tcl]]} {
		source [file join $dir ttrace.tcl]
	    }
	    if {[llength [info commands ttrace::update]]} {
		ttrace::update
	    }
	}} $dir]





























|
|
>
>

<
>
>














>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# -*- tcl -*-
# Tcl package index file, version 1.1
#
if {[package vsatisfies [package provide Tcl] 8.4]} {

    if {[llength [info commands apply]]} {
	# We can use a lambda (anon function) and ::tcl::pkgconfig


	if {([info commands ::tcl::pkgconfig] eq "")
		|| ![::tcl::pkgconfig get threaded]} return

	package ifneeded Ttrace @PACKAGE_VERSION@ [list ::apply {{dir} {
	    if {[info exists ::env(TCL_THREAD_LIBRARY)] &&
		[file readable $::env(TCL_THREAD_LIBRARY)/ttrace.tcl]} {
		source $::env(TCL_THREAD_LIBRARY)/ttrace.tcl
	    } elseif {[file readable [file join $dir .. lib ttrace.tcl]]} {
		source [file join $dir .. lib ttrace.tcl]
	    } elseif {[file readable [file join $dir ttrace.tcl]]} {
		source [file join $dir ttrace.tcl]
	    }
	    if {[llength [info commands ttrace::update]]} {
		ttrace::update
	    }
	}} $dir]
    } else {
	# No anon functions available, go with the necessary evil of a
	# named procedure, but use package specific prefix and no
	# hardwired data changing between package versions.

	if {[array names ::tcl_platform threaded] != "threaded"} return

	package ifneeded Ttrace @PACKAGE_VERSION@ [list @PACKAGE_NAME@_source $dir]

	proc @PACKAGE_NAME@_source {dir} {
	    if {[info exists ::env(TCL_THREAD_LIBRARY)] &&
		[file readable $::env(TCL_THREAD_LIBRARY)/ttrace.tcl]} {
		source $::env(TCL_THREAD_LIBRARY)/ttrace.tcl
	    } elseif {[file readable [file join $dir .. lib ttrace.tcl]]} {
		source [file join $dir .. lib ttrace.tcl]
	    } elseif {[file readable [file join $dir ttrace.tcl]]} {
		source [file join $dir ttrace.tcl]
	    }
	    if {[llength [info commands ttrace::update]]} {
		ttrace::update
	    }
	    rename @PACKAGE_NAME@_source {}
	}
    }
    package ifneeded Thread @PACKAGE_VERSION@ [list load [file join $dir @PKG_LIB_FILE@]]
}

Changes to unix/CONFIG.

28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# with the exact location, as found in your system:
# 
# ../configure --enable-threads --with-gdbm=/my/gdbm
#
#
# AOLserver 4.X; Uses public Tcl library.
# ----------------------------------------------------
# aoldir="/usr/local/aolserver"
# ../configure --enable-threads \
#   --with-aolserver=$aoldir \
#   --prefix=$aoldir --exec-prefix=$aoldir
#
# AOLserver uses its own package loading mechanism.
# To load, just do "ns_eval package require Thread"
# at the AOLserver startup or later from any thread.
#
#
# Mac OS X; Uses public Tcl library.
# ----------------------------------------------------
# ../configure --enable-threads \
#   --mandir=/usr/local/share/man \
#   --libdir=/Library/Tcl \







|

|
|

|

|







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# with the exact location, as found in your system:
# 
# ../configure --enable-threads --with-gdbm=/my/gdbm
#
#
# AOLserver 4.X; Uses public Tcl library.
# ----------------------------------------------------
# nsdir="/usr/local/naviserver"
# ../configure --enable-threads \
#   --with-naviserver=$nsdir \
#   --prefix=$nsdir --exec-prefix=$nsdir
#
# NaviServer/AOLserver uses its own package loading mechanism.
# To load, just do "ns_eval package require Thread"
# at the NaviServer/AOLserver startup or later from any thread.
#
#
# Mac OS X; Uses public Tcl library.
# ----------------------------------------------------
# ../configure --enable-threads \
#   --mandir=/usr/local/share/man \
#   --libdir=/Library/Tcl \

Changes to unix/README.

24
25
26
27
28
29
30
31
32
33
34
35
36

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
You might want to do "make test" before doing the "make install" in order
to run the regression tests on the package. 

To explore other building options, look into the CONFIG file for more
information.


Note for AOLserver users
------------------------

The extension can be compiled as a loadable module for the AOLserver 
version 4.0 or higher. In order to do this, use "--with-aolserver"
configure option to specify the directory containing the AOLserver

distribution. The CONFIG script has an example how to invoke configure
in order to build the extension as AOLserver module.
Note, however, that "make install" and "make test" targets are still
not supported for AOLserver builds. This will be corrected in one of
the future releases.

To fine-tune, you might also want to make the tsv::* commands replace
the AOLserver built-in nsv_* family of commands, since they are API 
compatible and provide richer command set plus advanced shared-object
storage of shared data. Go to the generic/threadSvCmd.h file and look
at the beginning of the file for the:

/* #define NSV_COMPAT 1 */

So, uncomment the line, recompile and there you go.


II. Building optional support libraries







|


|
|
|
>
|
|
|
|



|
|
|
|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
You might want to do "make test" before doing the "make install" in order
to run the regression tests on the package. 

To explore other building options, look into the CONFIG file for more
information.


Note for NaviServer/AOLserver users
------------------------

The extension can be compiled as a loadable module for the
NaviServer/AOLserver  version 4.0 or higher. In order to do this,
use "--with-naviserver" configure option to specify the directory
containing the NaviServer/AOLserver distribution. The CONFIG script
has an example how to invoke configure in order to build the
extension as NaviServer/AOLserver module. Note, however, that
"make install" and "make test" targets are still not supported for
NaviServer/AOLserver builds. This will be corrected in one of
the future releases.

To fine-tune, you might also want to make the tsv::* commands replace
the NaviServer/AOLserver built-in nsv_* family of commands, since
they are API  compatible and provide richer command set plus advanced
shared-object storage of shared data. Go to the generic/threadSvCmd.h
file and look at the beginning of the file for the:

/* #define NSV_COMPAT 1 */

So, uncomment the line, recompile and there you go.


II. Building optional support libraries

Changes to win/makefile.vc.

160
161
162
163
164
165
166

167
168
169
170
171
172
173
!include "pkg.vc"

DOTVERSION      = $(PACKAGE_VERSION:"=) #"
VERSION         = $(PACKAGE_MAJOR)$(PACKAGE_MINOR)
STUBPREFIX      = $(PROJECT)stub

DLLOBJS = \

	$(TMP_DIR)\threadCmd.obj \
	$(TMP_DIR)\threadSvCmd.obj \
	$(TMP_DIR)\threadSpCmd.obj \
	$(TMP_DIR)\threadPoolCmd.obj \
	$(TMP_DIR)\psGdbm.obj \
	$(TMP_DIR)\threadSvListCmd.obj \
	$(TMP_DIR)\threadSvKeylistCmd.obj \







>







160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
!include "pkg.vc"

DOTVERSION      = $(PACKAGE_VERSION:"=) #"
VERSION         = $(PACKAGE_MAJOR)$(PACKAGE_MINOR)
STUBPREFIX      = $(PROJECT)stub

DLLOBJS = \
	$(TMP_DIR)\threadNs.obj \
	$(TMP_DIR)\threadCmd.obj \
	$(TMP_DIR)\threadSvCmd.obj \
	$(TMP_DIR)\threadSpCmd.obj \
	$(TMP_DIR)\threadPoolCmd.obj \
	$(TMP_DIR)\psGdbm.obj \
	$(TMP_DIR)\threadSvListCmd.obj \
	$(TMP_DIR)\threadSvKeylistCmd.obj \
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
.PHONY: $(OUT_DIR)\pkgIndex.tcl

$(OUT_DIR)\pkgIndex.tcl: $(ROOT)\pkgIndex.tcl.in
	@nmakehlp -s << $** > $@
@PACKAGE_NAME@       thread
@PACKAGE_VERSION@    $(DOTVERSION)
@PKG_LIB_FILE@       $(PRJLIBNAME)
@TCL_VERSION@        $(TCL_DOTVERSION)
<<

#---------------------------------------------------------------------
# Installation. (EDIT)
#
# You may need to modify this section to reflect the final distribution
# of your files and possibly to generate documentation.







<







439
440
441
442
443
444
445

446
447
448
449
450
451
452
.PHONY: $(OUT_DIR)\pkgIndex.tcl

$(OUT_DIR)\pkgIndex.tcl: $(ROOT)\pkgIndex.tcl.in
	@nmakehlp -s << $** > $@
@PACKAGE_NAME@       thread
@PACKAGE_VERSION@    $(DOTVERSION)
@PKG_LIB_FILE@       $(PRJLIBNAME)

<<

#---------------------------------------------------------------------
# Installation. (EDIT)
#
# You may need to modify this section to reflect the final distribution
# of your files and possibly to generate documentation.

Changes to win/nmakehlp.c.

494
495
496
497
498
499
500
501
502
503

504
505
506
507
508
509
510

	while (fgets(szBuffer, cbBuffer, fp) != NULL) {
	    LPSTR p, q;

	    p = strstr(szBuffer, match);
	    if (p != NULL) {
		/*
		 * Skip to first digit.
		 */


		while (*p && !isdigit(*p)) {
		    ++p;
		}

		/*
		 * Find ending whitespace.
		 */







|


>







494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511

	while (fgets(szBuffer, cbBuffer, fp) != NULL) {
	    LPSTR p, q;

	    p = strstr(szBuffer, match);
	    if (p != NULL) {
		/*
		 * Skip to first digit after the match.
		 */

		p += strlen(match);
		while (*p && !isdigit(*p)) {
		    ++p;
		}

		/*
		 * Find ending whitespace.
		 */

Changes to win/pkg.vc.

1
2
3
4
5
6
# remember to change configure.in as well when these change
# (then re-autoconf)

PACKAGE_MAJOR	= 2
PACKAGE_MINOR	= 7
PACKAGE_VERSION	= "2.7b1"





|
1
2
3
4
5
6
# remember to change configure.in as well when these change
# (then re-autoconf)

PACKAGE_MAJOR	= 2
PACKAGE_MINOR	= 7
PACKAGE_VERSION	= "2.7.0"

Changes to win/thread_win.dsp.

84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
ROOT=..

# Begin Group "generic"

# PROP Default_Filter ""
# Begin Source File

SOURCE=$(ROOT)\generic\aolstub.cpp
# End Source File
# Begin Source File

SOURCE=$(ROOT)\generic\psGdbm.c
# End Source File
# Begin Source File








|







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
ROOT=..

# Begin Group "generic"

# PROP Default_Filter ""
# Begin Source File

SOURCE=$(ROOT)\generic\threadNs.c
# End Source File
# Begin Source File

SOURCE=$(ROOT)\generic\psGdbm.c
# End Source File
# Begin Source File