[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: [rtl] RTLinux concepts....



At 09:14 PM 6/7/98 +0400, Michael Barabanov wrote:
>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/
>
>

Thanks for the info.  One further question though...If the call to 
rt_task_suspend doesn't return, then isn't that problematic if it's
called from a task other than the one being suspended?  I.e. if in
task A, I decide that task B should be stopped, then task A won't 
continue execution past the line where it tries to suspend task B.

P.S.  I couldn't get to the URL for the RT-IPC stuff.  Perhaps it's
temporarily down.

Thanks again.
Jim.

--- [rtl] ---
For more information on Real-Time Linux see:
http://www.rtlinux.org/