* 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
This commit is contained in:
Guido van Rossum 1992-08-05 19:58:53 +00:00
parent 25bec8c8dc
commit ff4949eeee
19 changed files with 382 additions and 150 deletions

View file

@ -30,6 +30,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "sysmodule.h"
#include "compile.h"
#include "frameobject.h"
#include "eval.h"
#include "ceval.h"
#include "opcode.h"
#include "bltinmodule.h"
@ -83,48 +84,28 @@ static object *build_class PROTO((object *, object *));
static frameobject *current_frame;
/* Interface for threads.
A module that plans to do a blocking system call (or something else
that lasts a long time and doesn't touch Python data) can allow other
threads to run as follows:
void *x;
...preparations here...
x = save_thread();
...blocking system call here...
restore_thread(x);
...interpretr result here...
For convenience, that the value of 'errno' is restored across the
the call to restore_thread().
The function init_save_thread() should be called only from
initthread() in "threadmodule.c".
Note that not yet all candidates have been converted to use this
mechanism!
*/
#ifdef USE_THREAD
#include <errno.h>
#include "thread.h"
static type_lock interpreter_lock;
void
init_save_thread()
{
#ifdef USE_THREAD
if (interpreter_lock)
fatal("2nd call to init_save_thread");
interpreter_lock = allocate_lock();
acquire_lock(interpreter_lock, 1);
#endif
}
#endif
/* Functions save_thread and restore_thread are always defined so
dynamically loaded modules needn't be compiled separately for use
with and without threads: */
void *
save_thread()
{