From ff4949eeee7f86117d4a69599777ff5564315e39 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 5 Aug 1992 19:58:53 +0000 Subject: * Makefile: cosmetics * socketmodule.c: get rid of makepair(); fix makesocketaddr to fix broken recvfrom() * socketmodule: get rid of getStrarg() * ceval.h: move eval_code() to new file eval.h, so compile.h is no longer needed. * ceval.c: move thread comments to ceval.h; always make save/restore thread functions available (for dynloaded modules) * cdmodule.c, listobject.c: don't include compile.h * flmodule.c: include ceval.h * import.c: include eval.h instead of ceval.h * cgen.py: add forground(); noport(); winopen(""); to initgl(). * bltinmodule.c, socketmodule.c, fileobject.c, posixmodule.c, selectmodule.c: adapt to threads (add BGN/END SAVE macros) * stdwinmodule.c: adapt to threads and use a special stdwin lock. * pythonmain.c: don't include getpythonpath(). * pythonrun.c: use BGN/END SAVE instead of direct calls; also more BGN/END SAVE calls etc. * thread.c: bigger stack size for sun; change exit() to _exit() * threadmodule.c: use BGN/END SAVE macros where possible * timemodule.c: adapt better to threads; use BGN/END SAVE; add longsleep internal function if BSD_TIME; cosmetics --- Python/pythonrun.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'Python/pythonrun.c') diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 2a68f24ada..c8921da2fd 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -33,14 +33,11 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "errcode.h" #include "sysmodule.h" #include "compile.h" +#include "eval.h" #include "ceval.h" #include "pythonrun.h" #include "import.h" -#ifdef USE_THREAD -extern void *save_thread(); -#endif - extern char *getpythonpath(); extern grammar gram; /* From graminit.c */ @@ -127,7 +124,6 @@ run_tty_1(fp, filename) FILE *fp; char *filename; { - void *save, *save_thread(), restore_thread(); object *m, *d, *v, *w; node *n; char *ps1, *ps2; @@ -150,9 +146,9 @@ run_tty_1(fp, filename) w = NULL; ps2 = ""; } - save = save_thread(); + BGN_SAVE err = parsefile(fp, filename, &gram, single_input, ps1, ps2, &n); - restore_thread(save); + END_SAVE XDECREF(v); XDECREF(w); if (err == E_EOF) @@ -330,8 +326,12 @@ parse_file(fp, filename, start, n_ret) int start; node **n_ret; { - return parsefile(fp, filename, &gram, start, + int ret; + BGN_SAVE + ret = parsefile(fp, filename, &gram, start, (char *)0, (char *)0, n_ret); + END_SAVE + return ret; } /* Simplified interface to parsestring */ @@ -366,6 +366,18 @@ goaway(sts) int sts; { flushline(); + +#ifdef USE_THREAD + + /* Other threads may still be active, so skip most of the + cleanup actions usually done (these are mostly for + debugging anyway). */ + + (void *) save_thread(); + donecalls(); + exit_prog(sts); + +#else /* USE_THREAD */ /* XXX Call doneimport() before donecalls(), since donecalls() calls wdone(), and doneimport() may close windows */ @@ -384,12 +396,8 @@ goaway(sts) } #endif /* TRACE_REFS */ -#ifdef USE_THREAD - (void) save_thread(); - exit_prog(sts); -#else exit(sts); -#endif +#endif /* USE_THREAD */ /*NOTREACHED*/ } -- cgit v1.2.1