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:
rsc
2004-09-17 00:38:29 +00:00
parent 984e353160
commit 06bb4ed20d
15 changed files with 205 additions and 218 deletions

View File

@@ -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");
}