Personal tools
You are here: Home Projects C++ Cfront releases Release 3.0.3 source lib task_SPARC TESTS exit_stat.C
Document Actions

exit_stat.C

by Michael L Powell last modified 2007-01-26 03:22

Click here to get the file

Size 1 kB - File type text/plain

File contents

#include <task.h>

const int STATUS = 1;

struct simple_task : task {
        simple_task(char*);
};

simple_task::simple_task(char* n) :task(n)
{
	int s = get_exit_status();
	if (s == 0) {
		printf("exit_status = %d\n", s);
		set_exit_status(STATUS); 
		printf("exit_status = %d\n", get_exit_status());
	}
	resultis(0);	//return control to main
}

main()
{
	printf("exit_status = %d\n", sched::get_exit_status());
        simple_task *st = new simple_task("st");
	thistask->delay(10);	// ensure st gets control
	if( sched::get_exit_status() != STATUS) {
		// Not OK, program will return -1
		sched::set_exit_status(-1);
	} else {
		//OK, program should return 0
		printf("exit_status = %d\n", thistask->get_exit_status());
		thistask->set_exit_status(0);
	}
	thistask->resultis(0);
}

« May 2024 »
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: