summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-08-05 19:58:53 (GMT)
committerGuido van Rossum <guido@python.org>1992-08-05 19:58:53 (GMT)
commitff4949eeee7f86117d4a69599777ff5564315e39 (patch)
tree551b1b2d53d665fb81d10dd1d51e433be0512604 /Python/pythonrun.c
parent25bec8c8dc0de55694cc573ef6d213ee5babd306 (diff)
downloadcpython-ff4949eeee7f86117d4a69599777ff5564315e39.zip
cpython-ff4949eeee7f86117d4a69599777ff5564315e39.tar.gz
cpython-ff4949eeee7f86117d4a69599777ff5564315e39.tar.bz2
* 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
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c34
1 files changed, 21 insertions, 13 deletions
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 @@ 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*/
}