Tcl Source Code

Check-in [4e3f024bd7]
Login

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

Overview
Comment:Mark unixforkevent-1.1 nonPortable, until proven on more platforms. Make sure that when testing for pthread_atfork the thread library is taken into account.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4e3f024bd725dd9eda444f28b192c8a8e0f8d285
User & Date: jan.nijtmans 2013-08-05 22:00:58
Context
2013-08-06
16:41
The value TCL_LOCATION_EVAL_LIST in the type field of a CmdFrame appears to exist only for the sake ... check-in: b673919222 user: dgp tags: trunk
04:15
The value TCL_LOCATION_EVAL_LIST in the type field of a CmdFrame appears to exist only for the sake ... check-in: a292acfcd1 user: dgp tags: dgp-bye-location-eval-list
2013-08-05
23:54
merge trunk check-in: 19c11d8c16 user: dgp tags: dgp-refactor
22:06
rebase against trunk Leaf check-in: e0957ec4b8 user: jan.nijtmans tags: bug-c4e230f29b
22:00
Mark unixforkevent-1.1 nonPortable, until proven on more platforms. Make sure that when testing for... check-in: 4e3f024bd7 user: jan.nijtmans tags: trunk
21:58
Mark unixforkevent-1.1 nonPortable, until proven on more platforms. check-in: 0107005970 user: jan.nijtmans tags: core-8-5-branch
2013-08-03
15:27
[3611643fff]: Support TclOO in autoload mechanism. check-in: f031beec9a user: dkf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/unixForkEvent.test.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
namespace import -force ::tcltest::*

testConstraint testfork [llength [info commands testfork]]

# Test if the notifier thread is well initialized in a forked interpreter
# by Tcl_InitNotifier
test unixforkevent-1.1 {fork and test writeable event} \
    -constraints testfork \
    -body {
	set myFolder [makeDirectory unixtestfork]
	set pid [testfork]
	if {$pid == 0} {
	    # we are the forked process
	    set result initialized
	    set h [open [file join $myFolder test.txt] w]







|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
namespace import -force ::tcltest::*

testConstraint testfork [llength [info commands testfork]]

# Test if the notifier thread is well initialized in a forked interpreter
# by Tcl_InitNotifier
test unixforkevent-1.1 {fork and test writeable event} \
    -constraints {testfork nonPortable} \
    -body {
	set myFolder [makeDirectory unixtestfork]
	set pid [testfork]
	if {$pid == 0} {
	    # we are the forked process
	    set result initialized
	    set h [open [file join $myFolder test.txt] w]

Changes to unix/configure.

4817
4818
4819
4820
4821
4822
4823



4824
4825
4826
4827
4828
4829
4830
		fi
	    fi
	fi

	# Does the pthread-implementation provide
	# 'pthread_attr_setstacksize' ?





for ac_func in pthread_attr_setstacksize pthread_atfork
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
if eval "test \"\${$as_ac_var+set}\" = set"; then







>
>
>







4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
		fi
	    fi
	fi

	# Does the pthread-implementation provide
	# 'pthread_attr_setstacksize' ?

	ac_saved_libs=$LIBS
	LIBS="$LIBS $THREADS_LIBS"


for ac_func in pthread_attr_setstacksize pthread_atfork
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
if eval "test \"\${$as_ac_var+set}\" = set"; then
4919
4920
4921
4922
4923
4924
4925

4926
4927
4928
4929
4930
4931
4932
  cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF

fi
done


    else
	TCL_THREADS=0
    fi
    # Do checking message here to not mess up interleaved configure output
    echo "$as_me:$LINENO: checking for building with threads" >&5
echo $ECHO_N "checking for building with threads... $ECHO_C" >&6
    if test "${TCL_THREADS}" = 1; then







>







4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
  cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF

fi
done

	LIBS=$ac_saved_libs
    else
	TCL_THREADS=0
    fi
    # Do checking message here to not mess up interleaved configure output
    echo "$as_me:$LINENO: checking for building with threads" >&5
echo $ECHO_N "checking for building with threads... $ECHO_C" >&6
    if test "${TCL_THREADS}" = 1; then

Changes to unix/tcl.m4.

672
673
674
675
676
677
678



679

680
681
682
683
684
685
686
		    fi
		fi
	    fi
	fi

	# Does the pthread-implementation provide
	# 'pthread_attr_setstacksize' ?



	AC_CHECK_FUNCS(pthread_attr_setstacksize pthread_atfork)

    else
	TCL_THREADS=0
    fi
    # Do checking message here to not mess up interleaved configure output
    AC_MSG_CHECKING([for building with threads])
    if test "${TCL_THREADS}" = 1; then
	AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])







>
>
>

>







672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
		    fi
		fi
	    fi
	fi

	# Does the pthread-implementation provide
	# 'pthread_attr_setstacksize' ?

	ac_saved_libs=$LIBS
	LIBS="$LIBS $THREADS_LIBS"
	AC_CHECK_FUNCS(pthread_attr_setstacksize pthread_atfork)
	LIBS=$ac_saved_libs
    else
	TCL_THREADS=0
    fi
    # Do checking message here to not mess up interleaved configure output
    AC_MSG_CHECKING([for building with threads])
    if test "${TCL_THREADS}" = 1; then
	AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])

Changes to unix/tclUnixTest.c.

562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
    }
    pid = fork();
    if (pid == -1) {
        Tcl_AppendResult(interp,
                "Cannot fork", NULL);
        return TCL_ERROR;
    }
#ifndef HAVE_PTHREAD_ATFORK
    /* Only needed when pthread_atfork is not present. */
    if (pid==0) {
	Tcl_InitNotifier();
    }
#endif
    Tcl_SetObjResult(interp, Tcl_NewIntObj(pid));
    return TCL_OK;
}







|
|







562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
    }
    pid = fork();
    if (pid == -1) {
        Tcl_AppendResult(interp,
                "Cannot fork", NULL);
        return TCL_ERROR;
    }
#if !defined(HAVE_PTHREAD_ATFORK) || defined(MAC_OSX_TCL)
    /* Only needed when pthread_atfork is not present or on OSX. */
    if (pid==0) {
	Tcl_InitNotifier();
    }
#endif
    Tcl_SetObjResult(interp, Tcl_NewIntObj(pid));
    return TCL_OK;
}