public class RealtimeThread extends Thread implements Schedulable
Jamaica Real-Time Specification for Java class RealtimeThread.
Threads of class RealtimeThread that are scheduled by the default PriorityScheduler can use an additional range of priorities that are higher than the priorities of normal Java threads.
Threads of class RealtimeThread that are allocated in scoped memory (any memory area that is not HeapMemory or ImmortalMemory) are not member of any thread group, the result of Thread.getThreadGroup() will be null for these threads.
Thread.State, Thread.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
RealtimeThread()
Constructor to create a RealtimeThread with default parameters
as in RealtimeThread(null, null, null, null, null, null).
|
RealtimeThread(SchedulingParameters scheduling)
Constructor to create a RealtimeThread using specified
scheduling parameters and default values for all other
parameters.
|
RealtimeThread(SchedulingParameters scheduling,
ReleaseParameters release)
Constructor to create a RealtimeThread using specified
scheduling and release parameters and default values for all
other parameters.
|
RealtimeThread(SchedulingParameters scheduling,
ReleaseParameters release,
MemoryParameters memory,
MemoryArea area,
ProcessingGroupParameters group,
Runnable logic)
Constructor to create a RealtimeThread using specified
scheduling, release, and memory parameters, using the specified
memory area, group, and logic.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addIfFeasible()
addIfFeasible adds this to the feasibility analysis of the
associated scheduler if the resulting system will be feasible.
|
boolean |
addToFeasibility()
addToFeasibility notifies the scheduler associated with this
that this schedulable object's scheduling, release, memory, and
processing group parameters take part in the feasibility
analysis.
|
static RealtimeThread |
currentRealtimeThread()
currentRealtimeThread returns a reference to the current
RealtimeThread.
|
void |
deschedulePeriodic()
deschedulePeriodic deschedules this thread if its release
parameters are PeriodicParameters.
|
static MemoryArea |
getCurrentMemoryArea()
Get the memory area that the calling
Schedulable object has
for its allocation context. |
static int |
getInitialMemoryAreaIndex()
getInitialMemoryAreaIndex returns the index of the current
RealtimeThread's or AsyncBaseEventHandler's initial memory area.
|
MemoryArea |
getMemoryArea()
getMemoryArea returns the initial memory area provided to the
constructor of this thread.
|
static int |
getMemoryAreaStackDepth()
getMemoryAreaStackDepth returns the current size of the stack of
entered memory areas of the current thread.
|
MemoryParameters |
getMemoryParameters()
getMemoryParameters returns a reference to the MemoryParameters of
this RealtimeThread.
|
static MemoryArea |
getOuterMemoryArea(int index)
getOuterMemoryArea returns the MemoryArea in the stack of entered
memory areas at the given index.
|
ProcessingGroupParameters |
getProcessingGroupParameters()
getProcessingGroupParameters returns the current
ProcessingGroupParameters of this RealtimeThread.
|
ReleaseParameters |
getReleaseParameters()
getReleaseParameters returns the current ReleaseParameters of this
RealtimeThread.
|
Scheduler |
getScheduler()
getScheduler returns the current scheduler of this RealtimeThread.
|
SchedulingParameters |
getSchedulingParameters()
getSchedulingParameters returns the SchedulingParameters of this
RealtimeThread.
|
void |
interrupt()
interrupt causes a generic AsynchronouslyInterruptedException to
be thrown in this RealtimeThread.
|
void |
release()
Increase the release count of the current realtime thread.
|
boolean |
removeFromFeasibility()
removeFromFeasibility informs the scheduler associated with this
RealtimeThread that this RealtimeThread should no longer be taken
into account in the feasibility analysis.
|
void |
run()
run contains only a call to logic.run if logic is not null.
|
void |
schedulePeriodic()
schedulePeriodic resumes the execution of a periodic thread,
i.e., unblocks waitForNextPeriod.
|
boolean |
setIfFeasible(ReleaseParameters release,
MemoryParameters memory)
setIfFeasible performs a feasibility analysis using the provided
release and memory parameters.
|
boolean |
setIfFeasible(ReleaseParameters release,
MemoryParameters memory,
ProcessingGroupParameters group)
setIfFeasible performs a feasibility analysis using the provided
release, memory, and processing group parameters.
|
boolean |
setIfFeasible(ReleaseParameters release,
ProcessingGroupParameters group)
setIfFeasible performs a feasibility analysis using the provided
release and processing group parameters.
|
boolean |
setIfFeasible(SchedulingParameters sched,
ReleaseParameters release,
MemoryParameters memory)
setIfFeasible performs a feasibility analysis using the provided
scheduling, release, and memory parameters.
|
boolean |
setIfFeasible(SchedulingParameters sched,
ReleaseParameters release,
MemoryParameters memory,
ProcessingGroupParameters group)
setIfFeasible performs a feasibility analysis using the provided
scheduling, release, memory, and processing group parameters.
|
void |
setMemoryParameters(MemoryParameters memory)
setMemoryParameters replaces the memory parameters for this
RealtimeThread with the parameters provided.
|
boolean |
setMemoryParametersIfFeasible(MemoryParameters memory)
setMemoryParametersIfFeasible performs a feasibility analysis
using the provided memory parameters.
|
void |
setProcessingGroupParameters(ProcessingGroupParameters group)
setProcessingGroupParameters sets the processing group parameters
of this thread.
|
boolean |
setProcessingGroupParametersIfFeasible(ProcessingGroupParameters group)
setProcessingGroupParametersIfFeasible performs a feasibility
analysis using the provided processing group parameters.
|
void |
setReleaseParameters(ReleaseParameters release)
setReleaseParameters replaces the release parameters for this
RealtimeThread with the parameters provided.
|
boolean |
setReleaseParametersIfFeasible(ReleaseParameters release)
setReleaseParametersIfFeasible performs a feasibility analysis
using the provided release parameters.
|
void |
setScheduler(Scheduler scheduler)
setScheduler sets the scheduler for this RealtimeThread.
|
void |
setScheduler(Scheduler scheduler,
SchedulingParameters scheduling,
ReleaseParameters release,
MemoryParameters memory,
ProcessingGroupParameters group)
setScheduler set the scheduler and scheduling, release, memory,
and processing group parameters for this RealtimeThread.
|
void |
setSchedulingParameters(SchedulingParameters scheduling)
setSchedulingParameters sets the scheduling parameters for this
RealtimeThread.
|
boolean |
setSchedulingParametersIfFeasible(SchedulingParameters scheduling)
setSchedulingParametersIfFeasible performs a feasibility
analysis using the provided scheduling parameters.
|
static void |
sleep(Clock clock,
HighResolutionTime time)
Sleep for a given relative or absolute time using the given
clock.
|
static void |
sleep(HighResolutionTime time)
Sleep for a given relative or absolute time using the clock
associated with time.
|
void |
start()
start starts this RealtimeThread.
|
void |
start(PhasingPolicy policy)
Start this RealtimeThread with a given phasing policy.
|
static boolean |
waitForNextPeriod()
Deprecated.
since RTSJ 2.0
|
static boolean |
waitForNextPeriodInterruptible()
Deprecated.
since RTSJ 2.0
|
static boolean |
waitForNextRelease()
Block the current realtime thread until the beginning of the next
period or a call to its
release() method. |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield
public RealtimeThread()
public RealtimeThread(SchedulingParameters scheduling)
IllegalArgumentException
- iff scheduling parameters are
not compatible with the default scheduler, i.e., iff they are
non-null and not an instance of PriorityParameters.IllegalAssignmentError
- if scheduling and this reside in
memory areas whose objects cannot refer to one another (in both
directions).scheduling
- SchedulingParameters to be associated with the new
thread. This can be shared with several Schedulable objects. If
it is null, a copy of the creator's value will be created in the
same memory area as this RealtimeThread object. If it is null and
the current thread is a normal Java thread, the scheduling
parameters will be set to the default priority.public RealtimeThread(SchedulingParameters scheduling, ReleaseParameters release)
IllegalArgumentException
- iff scheduling or release
parameters are not compatible with the default scheduler, i.e.,
iff they are non-null and not an instance of PriorityParameters
or PeriodicParameters, AperidodicParameters and
SporadicParameters, respectively.IllegalAssignmentError
- if scheduling or release and this
reside in memory areas whose objects cannot refer to one another
(in both directions).scheduling
- SchedulingParameters to be associated with the new
thread. This can be shared with several Schedulable objects. If
it is null, a copy of the creator's value will be created in the
same memory area as this RealtimeThread object. If it is null and
the current thread is a normal Java thread, the scheduling
parameters will be set to the default priority.release
- ReleaseParameters to be associated with the new
thread. This can be shared with several Schedulable objects. If
it is null, default release parameters will be used.public RealtimeThread(SchedulingParameters scheduling, ReleaseParameters release, MemoryParameters memory, MemoryArea area, ProcessingGroupParameters group, Runnable logic)
Constructor to create a RealtimeThread using specified scheduling, release, and memory parameters, using the specified memory area, group, and logic.
If group is null, the thread group is inherited from the creating thread unless this RealtimeThread object resides in ScopedMemory. In this case, the thread group will be set to null.
IllegalArgumentException
- iff scheduling or release
parameters are not compatible with the default scheduler, i.e.,
iff they are non-null and not an instance of PriorityParameters
or PeriodicParameters, AperidodicParameters and
SporadicParameters, respectively.IllegalAssignmentError
- if scheduling, release, memory,
area, group, or logic reside in memory areas whose objects cannot
be referred to by this or this object resides in a memory area that
cannot be referenced by scheduling, release, or memory.scheduling
- SchedulingParameters to be associated with the new
thread. This can be shared with several Schedulable objects. If
it is null, a copy of the creator's value will be created in the
same memory area as this RealtimeThread object. If it is null and
the current thread is a normal Java thread, the scheduling
parameters will be set to the default priority.release
- ReleaseParameters to be associated with the new
thread. This can be shared with several Schedulable objects. If
it is null, default release parameters will be used.memory
- MemoryParameters to be associated with the new
thread. May be null for unrestricted amount and rate of memory
allocation for the new thread.area
- MemoryArea to be used by the new thread. If it is
null, the current memory area of the calling thread will be used.group
- ProcessingGroupParameters to be associated with
this. This can be shared with several Schedulable objects. If it
is null, this will not be associated with any processing group.logic
- Runnable to be used as the logic for this. If it is
null, the run() method in this new RealtimeThread object will be
called when the thread is started.public void run()
run
in interface Runnable
run
in class Thread
Thread.start()
,
Thread.stop()
,
Thread.Thread(ThreadGroup, Runnable, String)
public boolean addToFeasibility()
addToFeasibility notifies the scheduler associated with this that this schedulable object's scheduling, release, memory, and processing group parameters take part in the feasibility analysis.
In case this schedulable object is already part of the feasiblility analysis, do nothing.
addToFeasibility
in interface Schedulable
public static RealtimeThread currentRealtimeThread() throws ClassCastException
currentRealtimeThread returns a reference to the current RealtimeThread.
This may also be called within an AsyncBaseEventHandler. The result, however, may not be the same for separate invocations of such a handler.
ClassCastException
- iff the current thread is not an
instance of RealtimeThread or an AsyncBaseEventHandler.public void deschedulePeriodic()
public MemoryParameters getMemoryParameters()
getMemoryParameters
in interface Schedulable
public MemoryArea getMemoryArea()
public ProcessingGroupParameters getProcessingGroupParameters()
getProcessingGroupParameters
in interface Schedulable
public ReleaseParameters getReleaseParameters()
getReleaseParameters
in interface Schedulable
public Scheduler getScheduler()
getScheduler
in interface Schedulable
public SchedulingParameters getSchedulingParameters()
getSchedulingParameters
in interface Schedulable
public void interrupt()
public boolean removeFromFeasibility()
removeFromFeasibility
in interface Schedulable
public void schedulePeriodic()
schedulePeriodic resumes the execution of a periodic thread, i.e., unblocks waitForNextPeriod. This can be used to resume execution in a deadline miss condition.
If the release parameters are not an instance of PeriodicParameters, this function has no effect.
public void setMemoryParameters(MemoryParameters memory) throws IllegalThreadStateException
setMemoryParameters replaces the memory parameters for this RealtimeThread with the parameters provided.
This change may change the feasibility of the current feasible set of this RealtimeThread's scheduler.
In JamaicaVM, this change becomes effective immediately.
setMemoryParameters
in interface Schedulable
IllegalArgumentException
- if the memory parameter value is
not compatible with the scheduler associated to this
RealtimeThread.IllegalAssignmentError
- if memory and this reside in
memory areas whose objects cannot refer to one another (in both
directions).IllegalThreadStateException
memory
- the new memory parameters. If null, the default
value for the associated scheduler will be used.public void setProcessingGroupParameters(ProcessingGroupParameters group)
setProcessingGroupParameters sets the processing group parameters of this thread.
In JamaicaVM, this change becomes effective immediately.
This change may change the feasibility of the current feasible set of this RealtimeThread's scheduler.
setProcessingGroupParameters
in interface Schedulable
IllegalArgumentException
- if the group argument is not
compatible with the scheduler of this RealtimeThread.group
- the new processing group parameters to be applied
for the next release of this. If null, the default value for
the scheduler will be used.public void setReleaseParameters(ReleaseParameters release) throws IllegalThreadStateException
setReleaseParameters replaces the release parameters for this RealtimeThread with the parameters provided.
This change may change the feasibility of the current feasible set of this RealtimeThread's scheduler.
In JamaicaVM, this change of periodic parameters becomes effective after the execution of the next period, i.e., on the next call to waitForNextPeriod or waitForNextPeriodInterruptible.
setReleaseParameters
in interface Schedulable
IllegalArgumentException
- if the release parameter value
is not compatible with the scheduler associated to this
RealtimeThread.IllegalAssignmentError
- if release and this reside in
memory areas whose objects cannot refer to one another (in both
directions).IllegalThreadStateException
- if the old ReleaseParameters
+ * are periodic, the new ReleaseParameters are not periodic, and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.release
- the new ReleaseParameters. If null, the default
value for the associated scheduler will be used.public void setScheduler(Scheduler scheduler, SchedulingParameters scheduling, ReleaseParameters release, MemoryParameters memory, ProcessingGroupParameters group) throws IllegalArgumentException, IllegalAssignmentError, IllegalThreadStateException, SecurityException
setScheduler set the scheduler and scheduling, release, memory, and processing group parameters for this RealtimeThread.
The change of the scheduler and scheduling and memory parameters will take place immediately for the default scheduler. release and processing group parameters will take effect on the next release.
This change may change the feasibility of the current feasible set of this RealtimeThread's scheduler.
setScheduler
in interface Schedulable
IllegalArgumentException
- if scheduler is null or the
scheduling, release, memory, or processing group parameters are
not compatible with the scheduler.IllegalAssignmentError
- if scheduler, scheduling, release,
memory, or group reside in memory areas whose objects cannot be
referred to by this or this object resides in a memory area that
cannot be referenced by scheduling, release, or memory.IllegalThreadStateException
- if the old release parameters
are periodic, the new release parameters are not periodic, and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.SecurityException
- if setting of the scheduler is not
allowed by the current RealtimeSystem setting.scheduler
- The scheduler to be used for this
RealtimeThread. Must not be null.scheduling
- SchedulingParameters to be associated with the
RealtimeThread. If null, the default value of the scheduler will
be used.release
- the new ReleaseParameters. If null, the default
value for the associated scheduler will be used.memory
- the new memory parameters. If null, the default
value for the associated scheduler will be used.group
- the new processing group parameters to be applied
for the next release of this. If null, use the default value for
the scheduler.public void setScheduler(Scheduler scheduler) throws IllegalArgumentException, IllegalAssignmentError, SecurityException
setScheduler sets the scheduler for this RealtimeThread. If this has been admitted to the feasible set, it remains in the feasible set.
This change may change the feasibility of the current feasible set of this RealtimeThread's scheduler.
setScheduler
in interface Schedulable
IllegalArgumentException
- iff the scheduler is null or the
current parameters of this are not compatible with the new
scheduler.IllegalAssignmentError
- if scheduler and this reside in
memory areas whose objects cannot refer to one another (in both
directions).SecurityException
- if setting of the scheduler is not
allowed by the current RealtimeSystem setting.scheduler
- the new scheduler to be used. Must not be null.public void setSchedulingParameters(SchedulingParameters scheduling) throws IllegalThreadStateException
setSchedulingParameters sets the scheduling parameters for this RealtimeThread.
In JamaicaVM, this change of scheduling parameters becomes effective immediately for the default PriorityScheduler.
setSchedulingParameters
in interface Schedulable
IllegalArgumentException
- iff scheduling is not compatible
with the scheduler.IllegalAssignmentError
- if scheduling and this reside in
memory areas whose objects cannot refer to one another (in both
directions).IllegalThreadStateException
scheduling
- the new scheduling parameters.public static void sleep(Clock clock, HighResolutionTime time) throws InterruptedException
Sleep for a given relative or absolute time using the given clock. The resolution of the time slept depends on the provided clock.
If time is a relative time, then wait for this relative time.
If the time is an absolute time, wait until clock reaches this time. If the given time is already passed, return immediately.
Note: If time uses a different time-base other than clock, time is associated with clock for purposes of this method. After the method has been executed, the old clock will be re-associated with time.
Note: Although it is permissible to call sleep when control is in an AsyncBaseEventHandler, this is not recommended! The method causes the thread that executes the handler to sleep and might also block other handlers that are executed by the same thread!
Note: It only makes sense to call this method with clocks that represent a kind of a date or calendar time. If there is a different clock available (e.g. a clock corresponding to the CPU execution time of the VM) and used as an argument, an IllegalArgumentException will be thrown to prevent undefined behavior.
InterruptedException
- if we are interrupted while
sleeping.IllegalArgumentException
- if time is a relative time less
than zero or clock doesn't support the concept of date.UnsupportedOperationException
- if clock doesn't support
the concept of date.clock
- the clock relative which we want to sleep. If null,
Clock.getRealtimeClock() will be used.time
- the AbsoluteTime or RelativeTime to sleep.public static void sleep(HighResolutionTime time) throws InterruptedException
Sleep for a given relative or absolute time using the clock associated with time. If no clock is associated, Clock.getRealtimeClock() is used.
If time is a relative time, then wait for this relative time.
If time is an absolute time, wait until this time is reached. If the given time has already passed, return immediately.
Note: Although it is permissible to call sleep when control is in an AsyncBaseEventHandler, this is not recommended! The method causes the thread that executes the handler to sleep and might also block other handlers that are executed by the same thread!
InterruptedException
- if we are interrupted while
sleeping.IllegalArgumentException
- if time is a relative time less
than zero or if time is null.UnsupportedOperationException
- if clock doesn't support
the concept of date.time
- the AbsoluteTime or RelativeTime to sleep.public boolean setIfFeasible(ReleaseParameters release, MemoryParameters memory, ProcessingGroupParameters group) throws IllegalArgumentException, IllegalAssignmentError, IllegalThreadStateException
setIfFeasible performs a feasibility analysis using the provided release, memory, and processing group parameters. If the system remains feasible with these new parameters, the parameters are replaced.
If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.
setIfFeasible
in interface Schedulable
IllegalArgumentException
- if the parameter values are not
compatible with the scheduler associated to this RealtimeThread.IllegalAssignmentError
- if release, memory or group and
this reside in memory areas whose objects cannot refer to one
another (in both directions).IllegalThreadStateException
- If the old release parameters
are periodic, the new release parameters are not periodic, and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.release
- the new release parameters. If null, the default
value for the associated scheduler will be used.memory
- the new memory parameters. If null, the default
value for the associated scheduler will be used.group
- the new processing group parameters. If null, the
default value for the associated scheduler will be used.public boolean setIfFeasible(ReleaseParameters release, ProcessingGroupParameters group) throws IllegalArgumentException, IllegalAssignmentError, IllegalThreadStateException
setIfFeasible performs a feasibility analysis using the provided release and processing group parameters. If the system remains feasible with these new parameters, the parameters are replaced.
If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.
setIfFeasible
in interface Schedulable
IllegalArgumentException
- if the parameter values are not
compatible with the scheduler associated to this RealtimeThread.IllegalAssignmentError
- if release or group and this
reside in memory areas whose objects cannot refer to one another
(in both directions).IllegalThreadStateException
- If the old release parameters
are periodic, the new release parameters are not periodic, and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.release
- the new release parameters. If null, the default
value for the associated scheduler will be used.group
- the new processing group parameters. If null, the
default value for the associated scheduler will be used.public boolean setIfFeasible(ReleaseParameters release, MemoryParameters memory) throws IllegalArgumentException, IllegalAssignmentError, IllegalThreadStateException
setIfFeasible performs a feasibility analysis using the provided release and memory parameters. If the system remains feasible with these new parameters, the parameters are replaced.
If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.
setIfFeasible
in interface Schedulable
IllegalArgumentException
- if the parameter values are not
compatible with the scheduler associated to this RealtimeThread.IllegalAssignmentError
- if release or memory and this
reside in memory areas whose objects cannot refer to one another
(in both directions).IllegalThreadStateException
- If the old release parameters
are periodic, the new release parameters are not periodic, and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.release
- the new release parameters. If null, the default
value for the associated scheduler will be used.memory
- the new memory parameters. If null, the default
value for the associated scheduler will be used.public boolean setIfFeasible(SchedulingParameters sched, ReleaseParameters release, MemoryParameters memory) throws IllegalArgumentException, IllegalAssignmentError, IllegalThreadStateException
setIfFeasible performs a feasibility analysis using the provided scheduling, release, and memory parameters. If the system remains + * feasible with these new parameters, the scheduling, release, and memory parameters are replaced.
If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.
setIfFeasible
in interface Schedulable
IllegalArgumentException
- if the parameter values are not
compatible with the scheduler associated to this RealtimeThread.IllegalAssignmentError
- if sched, release, or memory and
this reside in memory areas whose objects cannot refer to one
another (in both directions).IllegalThreadStateException
- if the old release parameters
are periodic, the new release parameters are not periodic, and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.sched
- the new scheduling parameters. If null, the default
value for the associated scheduler will be used. This
default value may be null.release
- the new release parameters. If null, the default
value for the associated scheduler will be used.memory
- the new memory parameters. If null, the default
value for the associated scheduler will be used.public boolean setIfFeasible(SchedulingParameters sched, ReleaseParameters release, MemoryParameters memory, ProcessingGroupParameters group)
setIfFeasible performs a feasibility analysis using the provided scheduling, release, memory, and processing group parameters. If the system remains feasible with these new parameters, the scheduling, release, memory, and processing group parameters are replaced.
If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.
setIfFeasible
in interface Schedulable
IllegalArgumentException
- if the parameter values are not
compatible with the scheduler associated to this RealtimeThread.IllegalAssignmentError
- if sched, release, memory, or group
and this reside in memory areas whose objects cannot refer to one
another (in both directions).IllegalThreadStateException
- If the old release parameters
are periodic, the new release parameters are not periodic, and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.sched
- the new scheduling parameters. If null, the default
value for the associated scheduler will be used. This
default value may be null.release
- the new release parameters. If null, the default
value for the associated scheduler will be used.memory
- the new memory parameters. If null, the default
value for the associated scheduler will be used.group
- the new processing group parameters. If null, the
default value for the associated scheduler will be used.public boolean addIfFeasible()
addIfFeasible adds this to the feasibility analysis of the associated scheduler if the resulting system will be feasible.
If the object is already included in the feasible set, do nothing.
addIfFeasible
in interface Schedulable
@Deprecated public static boolean waitForNextPeriod() throws IllegalThreadStateException
waitForNextPeriod delays the current periodic thread until the beginning of the next period. The first period starts when the thread's logic starts to run, all successive periods start after a call to waitForNextPeriod or waitForNextPeriodInterruptible returns.
If the last call to waitForNextPeriod or waitForNextPeriodInterruptible returned false and schedulePeriodic() was not called since, this will block until a call to schedulePeriodic().
IllegalThreadStateException
- if the release parameters of
this are not of type PeriodicParameters.ClassCastException
- if the current thread is not an
instance of RealtimeThread.@Deprecated public static boolean waitForNextPeriodInterruptible() throws IllegalThreadStateException, InterruptedException
waitForNextPeriodInterruptible is an exact copy of waitForNextPeriod, but permits to be interrupted when waiting for the next period or when waiting for a call to schedulePeriodic().
waitForNextPeriodInterruptible delays the current periodic thread until the beginning of the next period. The first period starts when the thread's logic starts to run, all successive periods start after a call to waitForNextPeriod or waitForNextPeriodInterruptible returns.
If the last call to waitForNextPeriod or waitForNextPeriodInterruptible returned false and schedulePeriodic() was not called since, this will block until a call to schedulePeriodic().
IllegalThreadStateException
- if the release parameters of
this are not of type PeriodicParameters.ClassCastException
- if the current thread is not an
instance of RealtimeThread.InterruptedException
- if this thread is interrupted by
interrupt() or AsynchronouslyInterruptedException.fire() during
the call to this method.public void release()
waitForNextRelease
,
cause the thread to unblock. Otherwise, change the thread state so
that next call to one of these methods returns immediately.public static boolean waitForNextRelease() throws IllegalThreadStateException, InterruptedException
release()
method. The first period
starts when the thread's logic starts to run, all successive periods
start after a call to waitForNextRelease()
returns.IllegalThreadStateException
- if the release parameters of
this are not of type PeriodicParameters.ClassCastException
- if the current thread is not an
instance of RealtimeThread.InterruptedException
public static MemoryArea getCurrentMemoryArea()
Schedulable
object has
for its allocation context. This method may be called from a
normal thread, but it should then the allocation context should be
either HeapMemory
or ImmortalMemory
. Realtime
threads use all allocation contexts.public void start()
start
in class Thread
Thread.run()
,
Thread.stop()
public void start(PhasingPolicy policy)
public boolean setProcessingGroupParametersIfFeasible(ProcessingGroupParameters group)
setProcessingGroupParametersIfFeasible performs a feasibility analysis using the provided processing group parameters. If the system remains feasible with these new parameters, parameters are replaced.
If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.
setProcessingGroupParametersIfFeasible
in interface Schedulable
IllegalArgumentException
- if the group parameter value is
not compatible with the scheduler associated to this
RealtimeThread.IllegalAssignmentError
- If group and this reside in memory
areas whose objects cannot refer to one another (in both
directions).group
- the new processing group parameters. If null, the
default value for the associated scheduler will be used.public boolean setSchedulingParametersIfFeasible(SchedulingParameters scheduling)
setSchedulingParametersIfFeasible performs a feasibility analysis using the provided scheduling parameters. If the system remains feasible with these new parameters, the scheduling parameters are replaced.
In JamaicaVM, this change of scheduling parameters becomes effective immediately for the default PriorityScheduler.
If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.
setSchedulingParametersIfFeasible
in interface Schedulable
IllegalArgumentException
- if the parameter values are not
compatible with the scheduler associated to this RealtimeThread.IllegalAssignmentError
- if sched, release, memory, or group
and this reside in memory areas whose objects cannot refer to one
another (in both directions).scheduling
- the new scheduling parameters. If null, the
default value of the of the associated scheduler will be
used. This default value may be null.public boolean setReleaseParametersIfFeasible(ReleaseParameters release) throws IllegalThreadStateException
setReleaseParametersIfFeasible performs a feasibility analysis using the provided release parameters. If the system remains feasible with the new parameters, the parameters are replaced.
If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.
setReleaseParametersIfFeasible
in interface Schedulable
IllegalArgumentException
- if the parameter values are not
compatible with the scheduler associated to this RealtimeThread.IllegalAssignmentError
- if release and this reside in
memory areas whose objects cannot refer to one another (in both
directions).IllegalThreadStateException
- If the old release parameters
are periodic, the new release parameters are not periodic, and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.release
- the new release parameters. If null, the default
value for the associated scheduler will be used.public boolean setMemoryParametersIfFeasible(MemoryParameters memory)
setMemoryParametersIfFeasible performs a feasibility analysis using the provided memory parameters. If the system remains feasible with the new memory parameters, the parameters are replaced.
In JamaicaVM, this change becomes effective immediately.
If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.
setMemoryParametersIfFeasible
in interface Schedulable
IllegalArgumentException
- if the memory parameter value is
not compatible with the scheduler associated to this
RealtimeThread.IllegalAssignmentError
- if memory and this reside in
memory areas whose objects cannot refer to one another (in both
directions).memory
- the new memory parameters. If null, the default
value for the associated scheduler will be used.public static int getMemoryAreaStackDepth()
public static MemoryArea getOuterMemoryArea(int index)
getOuterMemoryArea returns the MemoryArea in the stack of entered memory areas at the given index. Return null if index is not a valid index in the stack (index < 0 or index >= getMemoryAreaStackDepth()).
ensure
((index >= 0) && (index < getMemoryAreaStackDepth()) || (Result == null),
(index < 0) || (index >= getMemoryAreaStackDepth()) || (Result != null))
index
- the index into the stackpublic static int getInitialMemoryAreaIndex()
getInitialMemoryAreaIndex returns the index of the current RealtimeThread's or AsyncBaseEventHandler's initial memory area.
ensure
(getOuterMemoryArea(Result) == currentRealtimeThread().getMemoryArea().
ClassCastException
- iff the current thread is not an
instance of RealtimeThread or an AsyncBaseEventHandler.aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2016 aicas GmbH. All Rights Reserved.