summaryrefslogtreecommitdiffstats
path: root/Python/thread.c
diff options
context:
space:
mode:
authorSjoerd Mullender <sjoerd@acm.org>1993-01-06 13:36:38 (GMT)
committerSjoerd Mullender <sjoerd@acm.org>1993-01-06 13:36:38 (GMT)
commited59d205a94747ad57f78ae35f46837a994da8cb (patch)
tree554f575cfa4887217b826e1b96d6456246854041 /Python/thread.c
parentfea2af1e9b0c99cac6cb8806c4af651a38e92d07 (diff)
downloadcpython-ed59d205a94747ad57f78ae35f46837a994da8cb.zip
cpython-ed59d205a94747ad57f78ae35f46837a994da8cb.tar.gz
cpython-ed59d205a94747ad57f78ae35f46837a994da8cb.tar.bz2
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.
Diffstat (limited to 'Python/thread.c')
-rw-r--r--Python/thread.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/Python/thread.c b/Python/thread.c
index 149190f..76a67af 100644
--- a/Python/thread.c
+++ b/Python/thread.c
@@ -23,7 +23,7 @@ static ulock_t wait_lock; /* lock used to wait for other threads */
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 @@ void init_thread _P0()
#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 @@ void init_thread _P0()
/*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);