This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ exceptions and multithreading


I implemented the changes as per my plan, and (amazingly)
it appears to work.

But I'm afraid...

Instructions on how to test changes above:

Modify the makefile for your eCos application to compile sched.cc
(C++ mode) and unwind-sjlj.c (C mode). The linker will then use 
the above code instead of the code from the GCC or eCos libraries.

Here is the test routine I ran to check that fc_static is a global
thread variable:

static void foo() throw (FirmwareException)
{
	throw IllegalState();
}

static void stressTest(cyg_addrword_t t)
{
	for (int i=0; i<100000; i++)
	{
		try
		{
			if ((i%10000)==0)
			{
				int x=0;
			}
			cyg_thread_yield();
			foo();
		}
		catch (...)
		{
		}
	}
}

static int stack[8192];

void testException() throw (FirmwareException)
{
	cyg_handle_t handle;
	cyg_thread thread;
	
	
	cyg_thread_create(10,
	stressTest,
	NULL,
	"silly",
	stack,
	sizeof(stack),
	&handle,
	&thread);
	
	
	cyg_thread_resume(handle);

	stressTest(0);

	cyg_thread_suspend(cyg_thread_self());	
	
	
}


int main(int argc, char **argv)
{
		
	testException();	
}



Øyvind

Attachment: unwind.h
Description: Binary data

Attachment: unwind-sjlj.c
Description: Binary data

Attachment: unwind.inc
Description: Binary data

Attachment: sched.cc
Description: Binary data

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]