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

2cancel.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

// This is the bug reported by Martin Carrol in mdc.2cancel.C, with 
// extraneous text removed.  This should print "passed" twice.
#include <task.h>
#include <iostream.h>

class mytask : public task 
{
public:
	mytask();
};

mytask::mytask()
{
	resultis(0);
}

main()
{
	mytask t;	// t runs and terminates here
			// cancel is called, and it frees space used
			// for t's stack
	object *o = new object;	// newly freed space for t's stack is reused
				// here for object
	o->remember(&t);	// remember TERMINATED task--this has been
				// changed since 2.1 to be a silent no-op
	t.cancel(0);		// second call of t->cancel; in post-2.1
				// releases, this is innocuous.
	o->forget(&t);  // dumped core on sun and 3b2 in 2.1 and earlier
			// releases because o had been corrupted by cancel.
	delete o;
	printf("passed\npassed\n");
	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: