process.h

Go to the documentation of this file.
00001 
00002 /*  $Id: process.h 1195 2006-04-05 21:49:30Z karstenw $    */
00003 
00004 /******************************************************************************
00005 
00006     UserLand Frontier(tm) -- High performance Web content management,
00007     object database, system-level and Internet scripting environment,
00008     including source code editing and debugging.
00009 
00010     Copyright (C) 1992-2004 UserLand Software, Inc.
00011 
00012     This program is free software; you can redistribute it and/or modify
00013     it under the terms of the GNU General Public License as published by
00014     the Free Software Foundation; either version 2 of the License, or
00015     (at your option) any later version.
00016 
00017     This program is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020     GNU General Public License for more details.
00021 
00022     You should have received a copy of the GNU General Public License
00023     along with this program; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 
00026 ******************************************************************************/
00027 
00028 #ifndef processinclude
00029 #define processinclude /*so other includes can tell if we've been loaded*/
00030 
00031 #ifndef langinclude
00032     
00033     #include "lang.h"
00034 
00035 #endif
00036 
00037 #ifndef threadsinclude
00038 
00039     #include "threads.h"
00040 
00041 #endif
00042 
00043 
00044 typedef struct tythreadglobals **hdlprocessthread;      // it's a hdlthreadglobals really; we're avoiding dependencies
00045 
00046 typedef struct typrocessrecord { 
00047     
00048     struct typrocessrecord **hnextprocess; /*nil-terminated list*/
00049     
00050     struct typrocesslist **hprocesslist; /*this list process is in, or nil*/
00051     
00052     hdltreenode hcode; /*the code that gets executed for this process*/
00053     
00054     hdltreenode holdcode; /*non-nil if code was replaced while agent was running*/
00055     
00056     hdlhashtable hcontext; /*non-nil if running from component API or other special cases*/
00057     
00058     langerrormessagecallback errormessagecallback;
00059     
00060     langerrormessagecallback debugerrormessagecallback;
00061 
00062     langvoidcallback clearerrorcallback;
00063     
00064     unsigned long sleepuntil; /*indicates when the process should wake up*/
00065     
00066     hdltablestack htablestack;
00067     
00068     hdlerrorstack herrorstack;
00069     
00070     hdlprocessthread hthread;
00071     
00072     boolean flsleepinbackground; /*if true, agent shouldn't be scheduled in the background*/
00073     
00074     boolean fldebugging; /*trap into debugger on every "meaty" instruction*/
00075     
00076     boolean flscheduled; /*has this processing been scheduled to run?*/
00077     
00078     boolean floneshot; /*if true process runs once and is then disposed*/
00079     
00080     boolean flrunning; /*is this processing running now?*/
00081     
00082     boolean fldisposewhenidle; /*was there an attempt to dispose of this process?*/
00083     
00084     boolean flprofiling; /*track time slice ticks*/
00085     
00086     boolean flprofilesliced; /*slice totals are not comulative*/
00087     
00088     struct tyexternalvariable **hprofiledata; /*table variable for perf data*/
00089     
00090     langvoidcallback processstartedroutine; /*execution is beginning*/
00091     
00092     langvoidcallback processkilledroutine; /*execution is terminating*/
00093     
00094     bigstring bsmsg; /*the last message posted by this agent*/
00095     
00096     bigstring bsname; // 5.0a22 dmb: why not maintain the name from the start?
00097     
00098     long processrefcon; /*for client use only*/
00099     } typrocessrecord, *ptrprocessrecord, **hdlprocessrecord;
00100 
00101 
00102 #if !flruntime
00103 
00104 typedef struct typrocesslist {
00105     
00106     hdlprocessrecord hfirstprocess; /*head of list*/
00107     
00108     /*hdlprocessrecord processlistmarker; /%for scheduler, pick up search from here*/
00109     
00110     short ctrunning; /*number of processes in this list currently running*/
00111     
00112     short ctsleeping; /*number of processes in this list currently sleeping*/
00113     
00114     boolean fldisposewhenidle; /*dispose when ctrunning returns to zero?*/
00115     } typrocesslist, *ptrprocesslist, **hdlprocesslist;
00116 
00117 #endif
00118 
00119 
00120 
00121 /*globals*/
00122 
00123 extern hdlprocessrecord currentprocess; /*process that's currently running*/
00124 
00125 extern hdlprocessrecord newlyaddedprocess; /*process that was just added to list*/
00126 
00127 extern unsigned short fldisableyield;
00128 
00129 extern boolean flcanusethreads;
00130 
00131 
00132 /*prototypes*/
00133 
00134 extern boolean setagentsenable (boolean);
00135 
00136 extern boolean agentsenabled (void);
00137 
00138 extern boolean agentsdisable (boolean);
00139 
00140 #if !flruntime
00141 
00142 extern boolean disposeprocesslist (hdlprocesslist);
00143 
00144 extern boolean newprocesslist (hdlprocesslist *);
00145 
00146 extern void setcurrentprocesslist (hdlprocesslist);
00147 
00148 #endif
00149 
00150 extern boolean pushprocess (hdlprocessrecord);
00151 
00152 extern boolean popprocess (void);
00153 
00154 extern void disposeprocess (hdlprocessrecord hprocess);
00155 
00156 extern boolean newprocess (hdltreenode, boolean, langerrorcallback, long, hdlprocessrecord *);
00157 
00158 extern boolean addprocess (hdlprocessrecord);
00159 
00160 extern boolean addnewprocess (hdltreenode, boolean, langerrorcallback, long);
00161 
00162 extern boolean processbackgroundtasks (void);
00163 
00164 extern boolean processisoneshot (boolean);
00165 
00166 extern boolean processagentsleep (long);
00167 
00168 extern boolean processfindcode (hdltreenode, hdlprocessrecord *);
00169 
00170 extern void processcodedisposed (long);
00171 
00172 extern boolean processreplacecode (hdltreenode, hdltreenode);
00173 
00174 extern boolean processdisposecode (hdltreenode);
00175 
00176 extern boolean debuggingcurrentprocess (void);
00177 
00178 extern boolean processstartprofiling (boolean);
00179 
00180 extern boolean processstopprofiling (void);
00181 
00182 extern boolean profilingcurrentprocess (void);
00183 
00184 extern boolean processruncode (hdlprocessrecord, tyvaluerecord *);
00185 
00186 extern boolean processruntext (Handle htext);
00187 
00188 extern boolean processrunstring (bigstring);
00189 
00190 extern boolean processrunstringnoerrorclear (bigstring);
00191 
00192 extern boolean processkill (hdlprocessrecord);
00193 
00194 // kw 2005-12-16 - These two are retired
00195 // extern void processinvalidglobals (WindowPtr);
00196 
00197 // extern void processinvalidoutline (struct tyoutlinerecord **);
00198 
00199 extern boolean abort1shotprocess (void);
00200 
00201 extern void killdependentprocesses (long);
00202 
00203 extern boolean newprocessthread (tythreadmaincallback, tythreadmainparams, hdlprocessthread *);
00204 
00205 extern boolean processpsuedothread (tythreadmaincallback, tythreadmainparams);
00206 
00207 extern short processthreadcount (void);
00208 
00209 extern boolean initprocessthread (bigstring);
00210 
00211 extern void exitprocessthread (void);
00212 
00213 extern hdlprocessthread getcurrentthread (void);
00214 
00215 extern void endprocessthread (hdlprocessthread);
00216 
00217 extern boolean infrontierthread (void);
00218 
00219 extern boolean goodthread (hdlprocessthread);
00220 
00221 extern boolean ingoodthread (void);
00222 
00223 extern long getthreadid (hdlprocessthread);
00224 
00225 extern hdlprocessthread getprocessthread (long);
00226 
00227 extern hdlprocessthread nthprocessthread (long);
00228 
00229 extern boolean wakeprocessthread (hdlprocessthread);
00230 
00231 extern boolean killprocessthread (hdlprocessthread);
00232 
00233 extern boolean processsleep (hdlprocessthread, unsigned long);
00234 
00235 extern boolean processissleeping (hdlprocessthread hthread);
00236 
00237 extern boolean processwake (hdlprocessthread);
00238 
00239 extern boolean processyield (void);
00240 
00241 extern boolean processyieldtoagents (void);
00242 
00243 extern boolean processbusy (void);
00244 
00245 extern boolean processnotbusy (void);
00246 
00247 extern boolean processrunning (void);
00248 
00249 extern boolean setprocesstimeslice (unsigned long);
00250 
00251 extern boolean getprocesstimeslice (unsigned long *);
00252 
00253 extern boolean setdefaulttimeslice (unsigned long);
00254 
00255 extern boolean getdefaulttimeslice (unsigned long *);
00256 
00257 extern boolean processtimesliceelapsed (void);
00258 
00259 extern unsigned long processstackspace (void);
00260 
00261 extern boolean scheduleprocess (hdlprocessrecord hprocess, hdlprocessthread *pnewthread);
00262 
00263 extern void processscheduler (void);
00264 
00265 extern void processchecktimeouts (void);
00266 
00267 extern boolean processsymbolunlinking (hdlhashtable, hdlhashnode);
00268 
00269 extern void processclose (void);
00270 
00271 extern boolean processwaitforquiet (long timeoutticks); 
00272 
00273 extern boolean initprocess (void);
00274 
00275 extern boolean processgetstats (hdlhashtable); /*6.2b6 AR*/
00276 
00277 #endif

Generated on Wed May 31 18:20:00 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6