The fttl_enable_periodic function enables the execution of
periodic threads on the timeline. This means that if the active
template contains any periodic threads, they will be periodically
copied to the timeline and executed. The interval between copies
is equal to the length of the active template. The application
may create any number of templates (see fttl_create_template) but
there is only one active template at any time (see
fttl_activate_template). When timeline scheduling is initialized
for the first time (see rt_set_scheduling_policy) the default
template becomes the active template and periodic execution is
disabled.
When fttl_thread_create is used to create a periodic thread it is
added to the active template, and if periodic execution is en-
abled, to any copies of the template on the timeline also. When
fttl_add_to_template is used to create a periodic thread it is
only added to the template specified in the call irrespective of
whether periodic execution is enabled or not. This allows one or
more templates to be loaded with periodic threads before execu-
tion of periodic threads is initiated. The
fttl_activate_template call is then used to select the active
template and the fttl_enable_periodic call with template_length
equal to zero initiates execution of that template.
The template_length specifies a new length for the active tem-
plate and deletes all threads currently on the template. Howev-
er, if template_length is equal to zero the length of the tem-
plate is not changed and the template is not cleared of threads.
Typically the length of the template is chosen to be the least
common multiple of the periods of the threads to be scheduled on
the template.
The active template is copied to the timeline whenever the time-
line becomes empty or when a non-periodic thread is scheduled
with a deadline later than the deadline of the tail of the time-
line. This allows the scheduler to ensure that the non-periodic
thread does not conflict with any instances of periodic threads
on the template. Because of this there may be multiple copies of
the template on the timeline.
PARAMETERS
template_length
The length in seconds.nanoseconds to set the ac-
tive template to. If this is zero the template length will
remain unchanged.
RETURN VALUE
KERN_SUCCESS
Periodic execution of timeline threads has been enabled.