Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/src/c++/lib/task/tst/Task.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();

	fprintf(stderr, "Task(%d)\n", i);

	resultis(i);
}

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

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

	printf("begin\n");

	for (i = 1; i <= nTask; i++) {
		NEW_TASK(Tp, Task(i));
	}

	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.