Rewrite to remove dependence on rendezvous and its bizarre
data structures. Makes it easier to use pthreads too. Still need to add code for non-pthreads systems. Just a checkpoint to switch work to another machine.
This commit is contained in:
@@ -40,7 +40,7 @@ main(int argc, char **argv)
|
||||
|
||||
//_threaddebuglevel = (DBGSCHED|DBGCHAN|DBGREND)^~0;
|
||||
_systhreadinit();
|
||||
_qlockinit(_threadrendezvous);
|
||||
_qlockinit(_threadsleep, _threadwakeup);
|
||||
_sysfatal = _threadsysfatal;
|
||||
notify(_threadnote);
|
||||
if(mainstacksize == 0)
|
||||
@@ -49,8 +49,9 @@ main(int argc, char **argv)
|
||||
a = _threadmalloc(sizeof *a, 1);
|
||||
a->argc = argc;
|
||||
a->argv = argv;
|
||||
|
||||
malloc(10);
|
||||
p = _newproc(mainlauncher, a, mainstacksize, "threadmain", 0, 0);
|
||||
malloc(10);
|
||||
_schedinit(p);
|
||||
abort(); /* not reached */
|
||||
return 0;
|
||||
@@ -61,7 +62,9 @@ mainlauncher(void *arg)
|
||||
{
|
||||
Mainarg *a;
|
||||
|
||||
malloc(10);
|
||||
a = arg;
|
||||
malloc(10);
|
||||
threadmain(a->argc, a->argv);
|
||||
threadexits("threadmain");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user