🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Co-routines in C++

#295
From: Mark E Hunter
Date: Thu, 28 Aug 1986 18:42
28 lines
849 bytes

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
Technical Details
Message-ID: <1743@wucs.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!caip!clyde!cbatt!cbosgd!ihnp4!wucs!meh

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!caip!clyde!cbatt!cbosgd!ihnp4!wucs!meh
From: meh@wucs.UUCP (Mark E Hunter)
Newsgroups: net.lang.c++
Subject: Co-routines in C++
Message-ID: <1743@wucs.UUCP>
Date: Thu, 28-Aug-86 14:42:02 EDT
Article-I.D.: wucs.1743
Posted: Thu Aug 28 14:42:02 1986
Date-Received: Sun, 31-Aug-86 05:04:48 EDT
Reply-To: meh@wucs.UUCP (Mark E Hunter)
Organization: Washington U. in St. Louis
Lines: 28