Thread View: net.lang.c++
2 messages
2 total messages
Started by Mark E Hunter
Thu, 28 Aug 1986 18:42
Co-routines in C++
Author: Mark E Hunter
Date: Thu, 28 Aug 1986 18:42
Date: Thu, 28 Aug 1986 18:42
28 lines
849 bytes
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
Re: Co-routines in C++
Author: Jonathan Shopiro
Date: Sun, 31 Aug 1986 20:32
Date: Sun, 31 Aug 1986 20:32
3 lines
639 bytes
639 bytes
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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads