Am Donnerstag, 31. Januar 2002 10:39 schrieben Sie:
> Hello,
> I'm having two problems concerning the handler for a rtfifo.
> I'm using the handler routine to activate threads on certain conditions.
>
> The idea is a periodic threads writes something into the control fifo. The
> handler routine checks if a condition is met and then activates a different
> thread.
>
> Here a my two problems:
>
> 1.) It seems that the fifo routine is not used the first time my thread
> writes into the fifo. From the 2nd til n period the handler routine is
> reliably activated.
>
> 2.) My periodic task writes a number into the fifo which should by idea
> read by the fifo handler and then be analyzed and acted upon. But every
> time my handler routine tries to read from the fifo the computer is
> resetted !!!!
As I understood any call of rft_get triggers the execution of a handler
installed with rtf_create_rt_handler.
In Your case this results in a recursion, no surprise Your system crashes.
You might need a second FIFO to get to the condition or maybe a condition
variable.
>
> BTW. Communication between a realtime thread and a user space program in
> the same module works just fine.
>
> Here a few code snips from my program to help understand the problem I'm
> in:
>
> void periodic_task (void *t)
> {
> int msg;
> msg=42;
> rtf_put(3, &msg, sizeof(msg));
> }
>
>
> int my_handler (int fifo)
> {
> int msg;
> rtf_get(3, &msg, sizeof(msg));
> .....
> }
>
>
> init_module()
> {
> ......
>
> rtf_create_rt_handler(3, &my_handler);
> }
>
> This is written from memory, so there might be a few spelling mistakes. The
> example actually works, except for the tow things mentioned above, when not
> using the rtf_get function in my_handler.
>
> If anyone has any idea, what I'm missing, I would be very grateful.
>
> Any help is highly appreciated.
>
> Thanks,
> Philip
>
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
/----------------------------------------------------\
| |
| inmess GmbH |
| Borngasse 9 Voice: +49 6152 97790 |
| Fax : +49 6152 977920 |
| D - 64572 Buettelborn Email : [EMAIL PROTECTED] |
| |
\----------------------------------------------------/
-- [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/