Tags:
related to ISRs and thread synchronization, C
Problem: An ISR and a 'yThread' share a common mailbox using which they communicate with each other. They use spinlock to have mutual exclusive access over the mailbox. Now since spinlocks cannot be used with interrupt routines, a work around is required. Operating System - LINUX!
Workaround: The ISR communicates to another thread say 'xThread' via event notification and further xThread and yThread communicate via spinlocks. Now the question here is how will the ISR notify the xThread of an event?
Help in this regard at the earliest will be very much appreciated. Thanks!
simplyifying the question - i want to know if there exist a mechanism in POSIX standard to make a thread wait "non-blocking" on an event?? And also is there a communication mechanism between an ISR and a normal thread? Because spinlocks, msg queues, etc do not work in interrupt context.
DATA FROM ISR IS NOT SERIAL.
Sorry if i confused everyone with my previous question.
Typically, you don't have a kernel thread (the ISR in this case) and a user thread sharing a mailbox in Linux (although this is common in embedded apps). But, one way you could go about this is to have the user space thread sleep waiting for a signal (see sigsuspend(2)) that the ISR generates (see the send_sig() kernel function). Note that this is method doesn't scale well, but it can be useful in simple situations.