Thread fix for 0.8.4 (and 0.8.3 in fact)
Bernie Solomon
kaffe@kaffe.org
Mon, 21 Apr 1997 12:01:57 +0000
I have just been getting up to speed on 0.8.4 (note if anyone is using
some of my HP changes a few still need to be reapplied especially if you
are using HP's C compiler).
Anyway for some reason 0.8.4 failed immediately on startup even though
the problem I found is also in 0.8.3 but I guess just memory allocation
order is different. The problem is that blockqueue for the threads
started by startDaemon wasn't initialised. My patch is to NULL out
pointer fields in newThreadCtx (which BTW I don't quite understand why
its external rather than static). Since I was doing this I have removed
the nulling out from other callers so its all in one place.
Bernie
-- diff -c ~/orig-kaffe-0.8.4/kaffe/kaffevm/thread.c
master/kaffe/kaffevm
*** /users/bernard/orig-kaffe-0.8.4/kaffe/kaffevm/thread.c Fri Apr
18 15:58:35 1997
--- master/kaffe/kaffevm/thread.c Mon Apr 21 12:57:20 1997
***************
*** 140,148 ****
THREADINFO(TCTX(currentThread));
DBG( printf("main thread %x base %x end %x\n", currentThread,
TCTX(currentThread)->stackBase, TCTX(currentThread)->stackEnd); )
TCTX(currentThread)->flags = THREAD_FLAGS_NOSTACKALLOC;
- TCTX(currentThread)->nextlive = 0;
- TCTX(currentThread)->nextalarm = 0;
- TCTX(currentThread)->blockqueue = 0;
currentThread->single_step = 0;
currentThread->daemon = 0;
currentThread->stillborn = 0;
--- 140,145 ----
***************
*** 187,194 ****
ALLOCTCTX(tid, threadStackSize);
assert(tid->PrivateInfo != 0);
TCTX(tid)->nextlive = liveThreads;
- TCTX(tid)->nextalarm = 0;
- TCTX(tid)->blockqueue = 0;
liveThreads = tid;
TCTX(tid)->flags = THREAD_FLAGS_GENERAL;
TCTX(tid)->status = THREAD_SUSPENDED;
--- 184,189 ----
***************
*** 1014,1019 ****
--- 1009,1017 ----
ct->stackEnd = ct->stackBase + stackSize;
ct->restorePoint = ct->stackEnd;
ct->exceptPtr = NULL;
+ ct->blockqueue = NULL;
+ ct->nextlive = NULL;
+ ct->nextalarm = NULL;
return (ct);
}
--
Bernie Solomon (bernard@edsug.com or Bernard.Solomon@acm.org)
Unigraphics Architecture, EDS-Unigraphics, Cambridge, UK