Mercurial > cpython-lru_cache-weakref
diff Python/thread.c @ 1179:9ae65ee09735 legacy-trunk
Various changes.
* Makefile: svmodule.c.proto and svgen.py are gone, svmodule.c came in
their stead. Also, pass -DUSE_DL flag to thread.c and give
the user a possibility to add the -DDEBUG to just thread.c.
* ceval.c: init_save_thread() can be called more than once now.
* svgen.py, svmodule.c.proto, svmodule.c: Removed prototype file and
replaced it by the generated file.
* thread.c: Added some more checks; added call to DL library when it
is also used to tell it where the shared arena is so that DL
can use some other area.
* threadmodule.c: Call init_save_thread from another place. Also,
added new function getlocklock() which does to lock objects
what getfilefile does to file objects.
| author | Sjoerd Mullender <sjoerd@acm.org> |
|---|---|
| date | Wed, 06 Jan 1993 13:36:38 +0000 |
| parents | 6b5a34db21fe |
| children | cf8ddb29e26e |
line wrap: on
line diff
--- a/Python/thread.c Mon Jan 04 09:16:51 1993 +0000 +++ b/Python/thread.c Wed Jan 06 13:36:38 1993 +0000 @@ -23,7 +23,7 @@ static int waiting_for_threads; /* protected by count_lock */ static int nthreads; /* protected by count_lock */ static int exit_status; -static int do_exit; +static int do_exit; /* indicates that the program is to exit */ static int exiting; /* we're already exiting (for maybe_exit) */ static pid_t my_pid; /* PID of main thread */ static pid_t pidlist[MAXPROC]; /* PIDs of other threads */ @@ -106,12 +106,14 @@ #ifdef DEBUG thread_debug = getenv("THREADDEBUG") != 0; #endif - dprintf(("init_thread called\n")); if (initialized) return; initialized = 1; + dprintf(("init_thread called\n")); #ifdef __sgi + if (usconfig(CONF_INITUSERS, 16) < 0) + perror("usconfig - CONF_INITUSERS"); my_pid = getpid(); /* so that we know which is the main thread */ atexit(maybe_exit); s.sa_handler = exit_sig; @@ -119,13 +121,20 @@ /*sigaddset(&s.sa_mask, SIGUSR1);*/ s.sa_flags = 0; sigaction(SIGUSR1, &s, 0); - prctl(PR_SETEXITSIG, SIGUSR1); - usconfig(CONF_ARENATYPE, US_SHAREDONLY); + if (prctl(PR_SETEXITSIG, SIGUSR1) < 0) + perror("prctl - PR_SETEXITSIG"); + if (usconfig(CONF_ARENATYPE, US_SHAREDONLY) < 0) + perror("usconfig - CONF_ARENATYPE"); /*usconfig(CONF_LOCKTYPE, US_DEBUGPLUS);*/ - shared_arena = usinit(tmpnam(0)); + if ((shared_arena = usinit(tmpnam(0))) == 0) + perror("usinit"); count_lock = usnewlock(shared_arena); (void) usinitlock(count_lock); wait_lock = usnewlock(shared_arena); + dprintf(("arena start: %lx, arena size: %ld\n", (long) shared_arena, (long) usconfig(CONF_GETSIZE, shared_arena))); +#ifdef USE_DL /* for python */ + dl_setrange((long) shared_arena, (long) shared_arena + 64 * 1024); +#endif #endif #ifdef sun lwp_setstkcache(STACKSIZE, NSTACKS);
