If the period of the interrupt is shorter than the sum of the ISR run time
and the run time of the second thread you will always see the condition you
mentioned.  

If you want the second thread to execute every time the ISR executes why not
just call it as a function in the same module.  

Watch out, if you call the second thread as a function and the total ISR
takes longer to run than the interrupt period you will miss interrupts.
Furthermore, it will use 100% of the CPU time and your system will lock up.

Rich

-----Original Message-----
From: Vijay Ananth.K [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 26, 2001 3:26 AM
To: [EMAIL PROTECTED]
Subject: [rtl] Semaphore Handling


Dear Friends,
        I am having a problem in using semaphore. Please advice me about
solving
this problem.

Environment:
~~~~~~~~~~~~
RT-Linux Ver 3.0 with Kernel 2.2 (From the FSM Labs CD, Direct Install)

My Setup:
~~~~~~~~~
My Driver is having an ISR which will be called whenever a interrupt comes
from my hardware. In the ISR, I am calling sem_post(Mysem).
I have written an another module which is having a thread and it will wait
for the above mentioned semaphore and access the hardware to read the data.
I am able to receive the interrupts and my ISR are is getting called
properly. And also my thread is waking properly and reading the data.

Problem:
~~~~~~~~
The no of interrupts and the no of reads are not matching. (Meaning), Let us
say (for an example) the ISR is invoked 100 times, but my thread is waking
for 60-70 times only. This means the semaphore is posted(over written) even
before the previous semaphore is utilized.

How can I solve this problem...

Please answer me ....



Vijay Ananth K
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/

Reply via email to