[comp.lang.c++] trouble with waitlist

aed@netcom.COM (Andrew Davidson) (04/07/91)

Hi I am having some trouble using the waitlist() function in the AT&T
task lib. basicly I am tring to use it to build a premptive system.

My idea was to have a task that created a timer and some other task to
do some kind of work.

class monitor(){
publicd:
	monitor();
}

monitor::monitor()
{
	timer *t = new timer(15);
	DoIt *d = new Doit();

	waitlist(t,d,0);

	int finished = 0;
	while (!finished)
	  {
		    if (d->rdstate = TERMINATE)
		finished = 1; 
	    else
		{
		t->reset(15);
		waitlist(t, d, 0);
		}
	  }
}

Here is what hapend, first the DOIT object ran to complettion,
then waitlist returned that doit finished! I expect the doit object
and the timer to wait for the waitlist() before they actualy started
doing there work! Does calling a tasks
constructor always run the task if the task does not explicitly wait
for some other task?

So I thought that I would change the doit construct or so that I could
pass in the thistask, and have the first statement of the doit
constructor call 

wait(passed in pointer to thistask)

That seem to make things worse. The program now terminates after the
second waitlist(). (it does not produce a core or error message) I
expect the doit object to start working as soon as waitlist was
called. I do not think the doit object ever did any of it actual work

OH I should not that I am working on a sun sparc running SUNOS 4.1 and
the  sun C++ compiler

Thanks Andy
-- 
-----------------------------------------------------------------
                  "bede-bede-bede Thats all Folks"
				Porky Pig
Andy Davidson
Woodside CA.
aed@netcom.COM
-----------------------------------------------------------------