public final class RealtimeSignal extends AsyncLongEvent implements ActiveEvent<RealtimeSignal,RealtimeSignalDispatcher>
ActiveEvent
subclass for defining a POSIX realtime
signal.Modifier and Type | Method and Description |
---|---|
void |
addHandler(AsyncBaseEventHandler handler)
Add a handler to the set of handlers associated with
this event.
|
static RealtimeSignal |
get(int id)
Gets a POSIX realtime signal by its ID.
|
static RealtimeSignal |
get(String name)
Gets a POSIX realtime signal by its name.
|
RealtimeSignalDispatcher |
getDispatcher()
Obtain the current dispatcher for this event.
|
int |
getId()
Gets the ID of this realtime signal.
|
static int |
getId(String name)
Gets the ID of a supported POSIX realtime signal by its name.
|
static int |
getMaxId()
Determines the highest system id for realtime signals.
|
static int |
getMinId()
Determines the lowest system id for realtime signals.
|
String |
getName()
Gets the name of this signal.
|
boolean |
isActive()
Determines the activation state of this signal,
i.e., whether or not it has been started.
|
static boolean |
isRealtimeSignal(int id)
Determines whether or not the given id represents a realtime
signal.
|
static boolean |
isRealtimeSignal(String name)
Determines whether or not the given name represents a POSIX realtime
signal.
|
boolean |
isRunning()
Determines the firing state, releasing or skipping, of this signal,
i.e., whether or not it is active and enabled.
|
void |
removeHandler(AsyncBaseEventHandler handler)
Remove a handler from the set associated with this event.
|
boolean |
send(long pid,
long payload)
Sends this signal to another process.
|
RealtimeSignalDispatcher |
setDispatcher(RealtimeSignalDispatcher value)
Change the current dispatcher for this event.
|
void |
setHandler(AsyncBaseEventHandler handler)
Associate a new handler with this event and remove all
existing handlers.
|
void |
start()
Starts this
RealtimeSignal , i.e., changes to a running state. |
void |
start(boolean disabled)
Starts this
RealtimeSignal , i.e., changes to a running state. |
boolean |
stop()
Stops this
RealtimeSignal . |
String |
toString()
Returns a string representation of the object.
|
void |
trigger(long payload) |
fire
createReleaseParameters, disable, enable, finalize, handledBy, hasHandlers
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
disable, enable
public static boolean isRealtimeSignal(String name)
name
- The name of the signal check.true
when a signal with the given name is registered, but
false
in all other cases.public static boolean isRealtimeSignal(int id)
id
- The numerical signal identifier to check.true
when a signal with the given id is defined, but
false
in all other cases.public static int getId(String name) throws POSIXInvalidSignalException
POSIXInvalidSignalException
- when no signal with the given
name exists or name
is null
.name
- The name of the signal whose ID should be determined.name
.public static RealtimeSignal get(String name) throws POSIXInvalidSignalException
POSIXInvalidSignalException
- when no signal with the given
name exists or name
is null
.name
- The name of the signal to get.public static RealtimeSignal get(int id) throws POSIXInvalidSignalException
POSIXInvalidSignalException
- when no signal with the given
identifier id
exists.id
- The identifier of a POSIX realtime signal.null
when
no signal with that ID exists.public static int getMinId()
getId(String)
called with the string
"SIGRTMIN"
or "SIGRT0"
.public static int getMaxId()
getId(String)
called with the string
"SIGRTMAX"
.public void trigger(long payload)
public int getId()
public String getName()
public RealtimeSignalDispatcher getDispatcher()
getDispatcher
in interface ActiveEvent<RealtimeSignal,RealtimeSignalDispatcher>
getDispatcher
in interface Releasable<RealtimeSignal,RealtimeSignalDispatcher>
public RealtimeSignalDispatcher setDispatcher(RealtimeSignalDispatcher value)
dispatcher
is null
, the default dispatcher is restored.setDispatcher
in interface ActiveEvent<RealtimeSignal,RealtimeSignalDispatcher>
public boolean isActive()
isActive
in interface ActiveEvent<RealtimeSignal,RealtimeSignalDispatcher>
true
when active; false
otherwise.public boolean isRunning()
isRunning
in interface ActiveEvent<RealtimeSignal,RealtimeSignalDispatcher>
isRunning
in class AsyncBaseEvent
true
when releasing, false
when skipping.public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
public final void start() throws StaticIllegalStateException
RealtimeSignal
, i.e., changes to a running state.
A running realtime signal is a source of activation when in a scoped memory
and is a member of the root set when in the heap. A running
realtime signal can be triggered.start
in interface ActiveEvent<RealtimeSignal,RealtimeSignalDispatcher>
StaticIllegalStateException
- when this
RealtimeSignal
has already been started.stop()
public void start(boolean disabled) throws StaticIllegalStateException
RealtimeSignal
, i.e., changes to a running state.
A running realtime signal is a source of activation when in a scoped memory
and is a member of the root set when in the heap. A running
realtime signal can be triggered.start
in interface ActiveEvent<RealtimeSignal,RealtimeSignalDispatcher>
StaticIllegalStateException
- when this
RealtimeSignal
has already been started.disabled
- true
for starting in a disabled state.stop()
public boolean stop() throws StaticIllegalStateException
RealtimeSignal
. A stopped realtime signal
ceases to be a source of activation and no longer causes any AE attached
to it to be a source of activation.stop
in interface ActiveEvent<RealtimeSignal,RealtimeSignalDispatcher>
StaticIllegalStateException
- when this
RealtimeSignal
is not running.true
when this
was enabled and
false
otherwise.public void addHandler(AsyncBaseEventHandler handler)
AsyncBaseEvent
addHandler
in class AsyncBaseEvent
handler
- The new handler to add to the list of
handlers already associated with this.
When handler is already associated with
the event, the call has no effectpublic void setHandler(AsyncBaseEventHandler handler)
AsyncBaseEvent
setHandler
in class AsyncBaseEvent
handler
- The instance of AsyncBaseEventHandler to
be associated with this. When handler is
null then no handler will be associated
with this, i.e., behave effectively as if
setHandler(null) invokes
removeHandler(AsyncBaseEventHandler) for
each associated handler.public void removeHandler(AsyncBaseEventHandler handler)
AsyncBaseEvent
removeHandler
in class AsyncBaseEvent
handler
- The handler to be disassociated from this. When
null nothing happens. When the handler is not
already associated with this then nothing happenspublic boolean send(long pid, long payload) throws POSIXSignalPermissionException, POSIXInvalidTargetException
On POSIX systems running in user space, the following holds:
POSIX.1-2001 requires the underlying mechanism of signal.send(-1)
to send signal
to all processes for which the current process may
signal, except possibly for some OS-defined system processes.
For an RTVM running in kernel space, the meaning of the pid
is implementation dependent, though it should be as closed to the standard
definition as possible.
POSIXSignalPermissionException
- when the process does not
have permission to send the target.POSIXInvalidTargetException
- when the target does not exist.pid
- The identifier of the process to which to send the signal.payload
- The long value associated with a fire.true
when successful and false
when not
due to a buffer overflowaicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2024 aicas GmbH. All Rights Reserved.