> I want to synchronize a user space thread to an external event that
> generates an interrupt. I thought of using the following approach: the
> ISR that treats the interrupt does a quick processing (such as data
> capture and buffering) and then sends data to the user space thread
> through a message queue or signals to the thread waiting on a
> semaphore and it gets the buffered data from shared memory or some
> similar mechanism. So far I haven't succeded in finding a way to do
> it. I've tryed to write a module which uses semaphores (<linux/sem.h>)
> but aparently there is no way to use SysV IPC primitives in kernel
> modules.
> I would appreciate having hints on how to do it or pointers to
> documentation and example code if available.
> Thank you very much in advance for your help.
> Elder.
A user-space signal is the equivalent of an interrupt.
When user-space drivers are involved, I like to use
"send_sig_info()" to send a signal to the user-space
task to indicate changes in the state of the driver.
I like to model the user/kernel space interface to
look like a hardware device in terms of interrupt/signal
handling, with ioctl's to acknowledge/enable/disable
signals/interrupts from the driver. However, I'm an
embedded type that is used to that kind of thing ;-)
Getting the data to/from kernel space is another
issue, typically done by the read/write driver
interface, or by using mmap().
--
Michael N. Moran (h) 770 516 7918
5009 Old Field Ct. (c) 678 521 5460
Kennesaw, GA, USA 30144 http://mnmoran.org
"... abstractions save us time working, but they don't
save us time learning."
Joel Spolsky, The Law of Leaky Abstractions
The Beatles were wrong: 1 & 1 & 1 is 1