* 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
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 2a68f24..c8921da 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -33,14 +33,11 @@
#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 @@
FILE *fp;
char *filename;
{
- void *save, *save_thread(), restore_thread();
object *m, *d, *v, *w;
node *n;
char *ps1, *ps2;
@@ -150,9 +146,9 @@
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 @@
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 @@
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 @@
}
#endif /* TRACE_REFS */
-#ifdef USE_THREAD
- (void) save_thread();
- exit_prog(sts);
-#else
exit(sts);
-#endif
+#endif /* USE_THREAD */
/*NOTREACHED*/
}