🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c++
Article #192

Trouble with Tasks

#192
From: Darrin West
Date: Mon, 12 May 1986 22:45
83 lines
2306 bytes
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.
Technical Details
Message-ID: <117@vaxb.calgary.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!alberta!calgary!west

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!alberta!calgary!west
From: west@calgary.UUCP (Darrin West)
Newsgroups: net.lang.c++
Subject: Trouble with Tasks
Message-ID: <117@vaxb.calgary.UUCP>
Date: Mon, 12-May-86 18:45:02 EDT
Article-I.D.: vaxb.117
Posted: Mon May 12 18:45:02 1986
Date-Received: Wed, 14-May-86 11:29:47 EDT
Organization: U. of Calgary, Calgary, Ab.
Lines: 83