Magic Mailing List |
|
From: Stefan Jones (stefan.jones AT multigig DOT com) Date: Wed Jun 25 2003 - 08:37:52 EDT
Tclspice + magic users, Below is the patch for tclspice so that you can run simulations in the background and still have the TCL command prompt in the foreground. This fixed the bug reported by Charles and others. It is in CVS and will be in the next release. 2003-06-25 Stefan Jones <stefan.jones AT multigig DOT com> * tclspice.c : Fix printing while running a background thread, seen eg. in Magic-7.2 Index: tclspice.c =================================================================== RCS file: /cvsroot/ngspice/ngspice/ng-spice-rework/src/Attic/tclspice.c,v retrieving revision 1.1.2.4 diff -u -r1.1.2.4 tclspice.c --- tclspice.c 9 Apr 2003 08:58:44 -0000 1.1.2.4 +++ tclspice.c 25 Jun 2003 12:26:06 -0000 @@ -326,15 +326,17 @@ /* Main spice command executions and thread control */ /*****************************************************************/ -static pthread_t tid; +static pthread_t tid, bgtid=(pthread_t)0; static bool fl_running = FALSE; static bool fl_exited = TRUE; static void *_thread_run(void *string){ fl_exited = FALSE; + bgtid = pthread_self(); cp_evloop((char *)string); FREE(string); + bgtid = (pthread_t)0; fl_exited = TRUE; return 0; } @@ -1360,8 +1362,9 @@ char *outptr, *bigstr = NULL, *finalstr = NULL; int i, nchars, result, escapes = 0; - if(f != stdout && f != stderr) - vfprintf(f,fmt,args_in); + if((f != stdout && f != stderr) || + ( fl_running && bgtid == pthread_self()) ) + return vfprintf(f,fmt,args_in); strcpy (outstr + 19, (f == stderr) ? "err \"" : "out \""); outptr = outstr; @@ -1456,6 +1459,9 @@ Tcl_SavedResult state; static char stdstr[] = "flush stdxxx"; char *stdptr = stdstr + 9; + + if ( fl_running && bgtid == pthread_self()) + return; Tcl_SaveResult(spice_interp, &state); strcpy(stdptr, (f == stderr) ? "err" : "out"); -- Stefan Jones <stefan.jones AT multigig DOT com> Multigig Ltd
|
|