Pierre PEIFFER wrote:

> Destroying a rt-ipc fifo on which a task is waiting causes a
> segmentation fault;
>

       I experienced a similar problem with a real-time task waiting for a
semaphore to be posted before it incremented a counter in an endless loop.

>
> In the init_module:
>         I create an rt-ipc fifo;
>         I initialize one task;
>         I start the task;

>
> What the task does:
>  only waits on some data from the created fifo (rtf_receive with timeout
> parameter equal to RT_WAIT_FOREVER). When available, it prints the data
> on the screen and still waits for other data. (in a loop)

>
> In the cleanup_module:
>         I delete the task -> done successfully.
>         I destroy the fifo -> this causes a segmentation fault, i.e. the call
> to rtf_ipc_destroy crashes, with some stack trace (?) on the screen.
>

     I had to include in my real-time task a boolean variable to exit the loop.
After the loop, I execute a rt_task_suspend() to put the task to sleep.


     volatile *counter;

  InterruptHandler()
{
      while(working) {
            rt_sem_wait(.......);
            if (working) {
               (*counter)++;
            }
       }

       rt_task_suspend(MYSELF);
}


cleanup_module()
{
       working = 0;
        rt_sem_post(.....);         // That unblocks the real-time task
        rt_sem_destroy(....);
        rt_task_ipc_delete(...);           // Needed because I use semaphores
}

>
> Bug ?
> Something I've forgot to do ?
> A way to avoid this ?
>

       I don't know either if it is a bug....

>
> Thanks !
>
>         Pierre

Hope this will help you until a better solution is found !

Stephane Ouellette
Tektrend International inc.

>
> --- [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/~rtlinux/


--- [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/~rtlinux/

Reply via email to