Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/src/c++/lib/task/tst/recTask.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#include <stdio.h>
#include <stdlib.h>
#include <task.h>
#include <Task.h>

int nTask = 1;

class Task : public task {
public:
	Task(int);
};

Task::Task(int i) : task("Task", SHARED, 3000)
{
	INIT_TASK();

	Task* Tp;

	printf("Task(%d)\n", i);

	if (--i > 0) {
		NEW_TASK(Tp, Task(i));
	}

	resultis(i);
}

void
main(int argc, char *argv[])
{
	Task* Tp;

	if (argc > 1) {
		nTask = atoi(argv[1]);
	}

	printf("begin\n");

	NEW_TASK(Tp, Task(nTask));

	printf("end\n");
	exit(0);
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.