You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-cvs@tcl.apache.org by mx...@apache.org on 2014/10/07 00:54:34 UTC
svn commit: r1629783 - in /tcl/rivet/trunk: ChangeLog
src/experimental/mod_rivet.c src/experimental/mod_rivet.h
src/experimental/rivetCore.c
Author: mxmanghi
Date: Mon Oct 6 22:54:34 2014
New Revision: 1629783
URL: http://svn.apache.org/r1629783
Log:
* src/experimental/mod_rivet.c: handling exception generated by ::rivet::exit_thread
* src/experimental/rivetCore.c: adding experimental ::rivet::inspect exit form for
detection of ::rivet::exit_thread call
Modified:
tcl/rivet/trunk/ChangeLog
tcl/rivet/trunk/src/experimental/mod_rivet.c
tcl/rivet/trunk/src/experimental/mod_rivet.h
tcl/rivet/trunk/src/experimental/rivetCore.c
Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/ChangeLog?rev=1629783&r1=1629782&r2=1629783&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Mon Oct 6 22:54:34 2014
@@ -1,3 +1,8 @@
+2014-10-06 Massimo Manghi <mx...@apache.org>
+ * src/experimental/mod_rivet.c: handling exception generated by ::rivet::exit_thread
+ * src/experimental/rivetCore.c: adding experimental ::rivet::inspect exit form for
+ detection of ::rivet::exit_thread call
+
2014-09-29 Massimo Manghi <mx...@apache.org>
* src/experimental/mod_rivet.c: adding mpm_exit_handler function pointer handling. Completed
draft solution for RivetUserConf directives. Scripts cannot be cached though and the whole
Modified: tcl/rivet/trunk/src/experimental/mod_rivet.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/experimental/mod_rivet.c?rev=1629783&r1=1629782&r2=1629783&view=diff
==============================================================================
--- tcl/rivet/trunk/src/experimental/mod_rivet.c (original)
+++ tcl/rivet/trunk/src/experimental/mod_rivet.c Mon Oct 6 22:54:34 2014
@@ -757,6 +757,13 @@ Rivet_ExecuteAndCheck(rivet_thread_priva
rivet_interp_globals *globals = Tcl_GetAssocData(interp_obj->interp, "rivet", NULL);
Tcl_Preserve (interp_obj->interp);
+
+ /* before execution we reset the thread_exit flag. It will in case set if
+ * ::rivet::thread_exit gets called
+ */
+
+ private->thread_exit = 0;
+
if ( Tcl_EvalObjEx(interp_obj->interp, tcl_script_obj, 0) == TCL_ERROR ) {
Tcl_Obj *errscript;
Tcl_Obj *errorCodeListObj;
@@ -808,9 +815,13 @@ Rivet_ExecuteAndCheck(rivet_thread_priva
}
else if (strcmp(errorCodeSubString, THREAD_EXIT_CODE) == 0)
{
- /* we simply finish up with this request and let the thread exit */
+ /* we simply set the thread_exit flag and finish with this
+ * request and proceed to check a after_every_script is defined */
+
+ private->thread_exit = 1;
goto good;
+
}
}
@@ -987,10 +998,9 @@ Rivet_ParseExecFile(rivet_thread_private
outbuf = Tcl_NewObj();
Tcl_IncrRefCount(outbuf);
- if (toplevel) {
- if (private->running->rivet_before_script) {
- Tcl_AppendObjToObj(outbuf,private->running->rivet_before_script);
- }
+ if (toplevel && private->running->rivet_before_script)
+ {
+ Tcl_AppendObjToObj(outbuf,private->running->rivet_before_script);
}
/*
Modified: tcl/rivet/trunk/src/experimental/mod_rivet.h
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/experimental/mod_rivet.h?rev=1629783&r1=1629782&r2=1629783&view=diff
==============================================================================
--- tcl/rivet/trunk/src/experimental/mod_rivet.h (original)
+++ tcl/rivet/trunk/src/experimental/mod_rivet.h Mon Oct 6 22:54:34 2014
@@ -239,6 +239,7 @@ typedef struct _thread_worker_private {
rivet_server_conf* running_conf; /* running configuration */
running_scripts* running; /* (per request) running conf scripts */
+ int thread_exit; /* Flag signalling thread_exit call */
} rivet_thread_private;
Modified: tcl/rivet/trunk/src/experimental/rivetCore.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/experimental/rivetCore.c?rev=1629783&r1=1629782&r2=1629783&view=diff
==============================================================================
--- tcl/rivet/trunk/src/experimental/rivetCore.c (original)
+++ tcl/rivet/trunk/src/experimental/rivetCore.c Mon Oct 6 22:54:34 2014
@@ -1439,6 +1439,15 @@ TCL_CMD_HEADER( Rivet_InspectCmd )
Tcl_DecrRefCount(dictObj);
}
+ else if (STRNEQU(cmd_arg,"exit"))
+ {
+ /* thread exit status flag */
+ Tcl_Obj* exit_flag = Tcl_NewIntObj(globals->private->thread_exit);
+
+ Tcl_IncrRefCount(exit_flag);
+ Tcl_SetObjResult(interp,exit_flag);
+ Tcl_DecrRefCount(exit_flag);
+ }
else
{
Tcl_Obj* par_value = NULL;
---------------------------------------------------------------------
To unsubscribe, e-mail: site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: site-cvs-help@tcl.apache.org