[net.lang.c++] Co-routines in C++

meh@wucs.UUCP (Mark E Hunter) (08/28/86)

Hello,
	Can anyone tell me why the message sector 2 gets printed twice?
Here is the source:
#include "task.h"
class pc : task
{
	pc(int);
};
pc::pc(int n)
{
	printf("pc %d\n",n);
};
main()
{
	int n;
	printf("sector 1\n");
	n = 1;
	new pc(n);
	printf("sector 2\n");
	thistask->sleep();
}
And here is the output
sector 1
pc 1
sector 2
sector 2

shopiro@alice.UucP (Jonathan Shopiro) (08/31/86)

Constructors of tasks shouldn't return, nor should main if tasks
are being used.  Use ``resultis(n)'' in the tasks and
``thistask->resultis(n)'' in main.