rtems_interrupt_is_in_progress() not working.

Nick Thomas nick.thomas at pixsan.com
Sat Jan 9 09:58:38 UTC 2010


Hi, I have the following function, which tries to obtain a semaphore, but
first checking that we are not inside an ISR.

But, it doesn't work.

It crashes in rtems_semaphore_obtain call, and the debugger shows that there
is an RTEMS error 18, which corresponds to doing the wrong thing inside an
ISR ( I think ).

So, why doesn't rtems_interrupt_is_in_progress() detect that the call is
inside an ISR?

--- SNIP ---
Void Lock(void)
{
	rtems_status_code stat;

	if (rtems_interrupt_is_in_progress() == FALSE)
	{
		stat = rtems_semaphore_obtain(M_The_mutex, RTEMS_WAIT, 0);
		if (stat != RTEMS_SUCCESSFUL)
		{
			printf("Lock: rtems_semaphore_obtain returned %d\n",
stat);
		}
	}
}
--- END ---

-----------------------------
Nick Thomas
Email: nick.thomas at pixsan.com 




More information about the users mailing list