diff Modules/threadmodule.c @ 926:c156d4960c2b legacy-trunk

* 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
author Guido van Rossum <guido@python.org>
date Wed, 05 Aug 1992 19:58:53 +0000
parents 72aceed365d4
children a31e07847063
line wrap: on
line diff
--- a/Modules/threadmodule.c	Wed Aug 05 19:00:45 1992 +0000
+++ b/Modules/threadmodule.c	Wed Aug 05 19:58:53 1992 +0000
@@ -27,15 +27,10 @@
 
 #include "allobjects.h"
 #include "modsupport.h"
-#include "compile.h"
 #include "ceval.h"
 
 #include "thread.h"
 
-extern void init_save_thread PROTO((void));
-extern void* save_thread PROTO((void));
-extern void restore_thread PROTO((void *));
-
 object *ThreadError;
 
 
@@ -83,7 +78,6 @@
 	lockobject *self;
 	object *args;
 {
-	void *save;
 	int i;
 
 	if (args != NULL) {
@@ -93,11 +87,9 @@
 	else
 		i = 1;
 
-	save = save_thread();
-
+	BGN_SAVE
 	i = acquire_lock(self->lock_lock, i);
-
-	restore_thread(save);
+	END_SAVE
 
 	if (args == NULL) {
 		INCREF(None);
@@ -193,8 +185,6 @@
 	if (res == NULL) {
 		fprintf(stderr, "Unhandled exception in thread:\n");
 		print_error(); /* From pythonmain.c */
-		fprintf(stderr, "Exiting the entire program\n");
-		goaway(1);
 	}
 	(void) save_thread();
 	exit_thread();
@@ -251,7 +241,7 @@
 {
 	if (!getnoarg(args))
 		return NULL;
-	return newlockobject();
+	return (object *) newlockobject();
 }
 
 static struct methodlist thread_methods[] = {