[net.lang.c++] Trouble with Tasks

west@calgary.UUCP (Darrin West) (05/13/86)

We have Release E - November 1984.  (this may be the problem).

Anyway, I've been trying for several days now to get a fairly
simple tasking system to work.

Very simple systems are fine (maybe).  eg: start one task from
main, doing some printing and delays.

However, when I try the following program, the constructor
for "dumb2" seems to be run twice.  After using "print(VERBOSE|CHAIN)"
I discovered that sometimes (I don't remember under which conditions)
the task or ready to run queues get fouled up too.

Notice that I am using a derived class for "dumb2".  When I change it
to a task class directly things seem to work better.

---

#include <task.h>

class dumb : public task{
public:
    dumb(char *);
};

dumb.dumb(char *n) : (n,0,0)
{
    printf("in dumb %s\n",n);
}


class dumb2 : public dumb{
public:
    dumb2(char *);
};

dumb2.dumb2(char *n) : (n)
{
    printf("in dumb2 %s\n",n);
    delay(1);
    printf("after delay in dumb2\n");
    resultis(5);
}

main()
{
    dumb2 *p;

    p = new dumb2("p");
    
    printf("back in main\n");
    thistask->delay(3);
    printf("after delay in main\n");
    printf("result %d\n",p->result());
}

---

This gives the following output:

in dumb p
in dumb2 p
in dumb2 p


***** task_error(11) schedule: running
thistask: task main (is thistask):
	this==29828 mode=DEDICATED alert=29700 next=29700 result=0
	stack: max=750 current=36 t_base=2147477784, t_frame=2147477748, t_size=0
run_chain:
task p (RUNNING):

---

Any help, including rude comments about misunderstanding the tasking system,
would be appreciated.  If there were fixes made to Release E that corrected
this problem a hint as to where to get them would also be helpful.

Darrin West
west@calgary.UUCP


It might be getting brighter OUTside.