[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: [rtl] RTLinux concepts....
Hello, James,
James Cassidy (jcassidy@nova.genesoft.com) wrote:
> If I want to have a rt fuction called *once* but at a specific
> delay later, I do a:
>
> rt_task_init( &doOnceTask, doOnce, 1, 3000, 4 );
> rt_task_make_periodic( &doOnceTask, rt_get_time() + delay, somePeriod );
>
>
> Then in the function to be called only once, at time now+delay:
>
> void once( int t ) {
> // do something interesting....
>
> // stop and further invocations
> rt_task_suspend( &doOnceTask );
>
> rt_task_wait();
> }
>
>
> Some questions...
>
> Is this the best way to use the rt functions to have a function called
> once, but at a precise time from now?
Seems like there's no a simpler way to do it with the standard scheduler.
There's the rt_task_delay function in the RT-IPC module (see below).
> Is it ok to call rt_task_suspend from within the task that's being suspended?
Yes.
> Is the call to rt_task_wait not required? If I've already suspended the
> task, should I just return?
The call to rt_task_wait is not required. The rt_task_suspend function will not
return (unless you call the rt_wakeup_task function from another task).
> Does returning from a task implicitly do a suspend on that task?
When the task function returns, the task is deleted.
> If I have one task that's updating a variable for other tasks to use, what
> functions are available for mutual exclusion?
Check out Jerry Epplin's RT-IPC module at http://stereotaxis.wustl.edu/~jerry/
Michael.
--- [rtl] ---
For more information on Real-Time Linux see:
http://www.rtlinux.org/