This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
RE: ISR+thread synchronization problem
- From: Geoff Patch <grp at cea dot com dot au>
- To: "'jagadisha maiya'" <pjmaiya at c4 dot com>
- Cc: "'ecos-discuss at sources dot redhat dot com'" <ecos-discuss at sources dot redhat dot com>
- Date: Fri, 25 Jan 2002 15:17:03 +1100
- Subject: RE: [ECOS] ISR+thread synchronization problem
Hi there,
> I was reading the mailing list regarding the ISR and thread
synchronization problem. In my project also I am also facing the same
problem. But mine is quite strange..
> I am not using DSR.
> ISR uses semaphore to post the event and task uses semaphore wait for
receiving the event.
> I am using counting semaphore with inital value '0' to use as a binary
semaphore.
>
> When an ISR post an event through semaphore, the task which waits on the
semaphore gets triggered and it services the data.
>
> After long time task stops accepting the event and found to be gone for
blocking state.
> >From there onwards any posting of the event from ISR never invokes the
thread.
>
> Can U give some suggestion to over come this apart from DSR. Can any body
tell me why the task went into blocking state even if it could have been
unblocked after receiving posted events.
I went through a bad week where exactly the same thing happened to me.
This has been discussed several times on the list, and the short answer is
that you can't call any functions that'll change the state of the scheduler
from within an ISR. What is happening in your case is that the scheduler
internal data structures are getting smashed, and the thread that is
waiting on the semaphore will never run even after posting the semaphore.
You need to move the semaphore post function into a DSR. There's no
alternative. In any case, the DSR will be ready to run and should get
scheduled almost immediately after the ISR terminates.
Hope this helps.
Geoff
------------------------------
Geoff Patch
Senior Software Engineer
CEA Technologies
Canberra Australia
02-6213 0141