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

delTERM2.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 Carroll in mdc.delTERM.C, with
// extraneous business of double cancel's removed, and longer remember
// lists added, but this one is expected to generate a runtime error,
// unlike delTERM.C.
#include <task.h>

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

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

mytask t;
mytask t2;

void f()
{
	object o;
	o.remember(&t);
	o.remember(&t2);
	o.remember(&t);
	t.cancel(0);
	// when o is deleted here, it is remembering 3 tasks, of which 
	// 2 (both t) are TERMINATED, but 1 (t2) isn't, so there will be
	// a runtime error.
}
main()
{
	f();
	thistask->resultis(0);
}
« March 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: