North State Framework in C#
V3.0.0
An object-oriented framework for implementing UML state machines.
|
Represents a thread that has an event queue and dispatches events to their destinations. More...
Public Member Functions | |
NSFEventThread (NSFString name) | |
Creates an event thread. More... | |
NSFEventThread (NSFString name, int priority) | |
Creates an event thread. More... | |
bool | hasEvent (NSFEvent nsfEvent) |
Indicates if the event queue contains an event that matches the specified event. More... | |
bool | hasEventFor (INSFEventHandler eventHandler) |
Indicates if the event queue contains an event for the specified destination. More... | |
void | removeEventsFor (INSFEventHandler eventHandler) |
Removes all events for the specified event handler. More... | |
void | queueEvent (NSFEvent nsfEvent, bool isPriorityEvent, bool logEventQueued) |
Queues the specified event. More... | |
override void | terminate (bool waitForTerminated) |
Terminates the thread by causing the thread loop to return. More... | |
![]() | |
NSFTaggedObject (NSFString name) | |
Creates an object with a unique id and a name. More... | |
![]() | |
NSFUniquelyNumberedObject () | |
Creates a uniquely numbered object. More... | |
bool | isSameObject (NSFUniquelyNumberedObject other) |
Checks if this object is the same as another object. More... | |
Protected Member Functions | |
override void | threadLoop () |
Implements the main event processing loop. More... | |
![]() | |
NSFThread (NSFString name) | |
Creates a thread. More... | |
NSFThread (NSFString name, int priority) | |
Creates an event thread. More... | |
void | handleException (Exception exception) |
Handles exceptions caught by main event processing loop. More... | |
void | startThread () |
Starts the thread by calling its execution action. More... | |
Properties | |
List< INSFEventHandler > | EventHandlers [get] |
Gets a list of event handlers using the thread. More... | |
![]() | |
NSFOSThread | OSThread [get, set] |
Gets the underlying OS thread. More... | |
NSFThreadTerminationStatus | TerminationStatus [get, set] |
Gets the thread termination status. More... | |
static uint | TerminationSleepTime [get, set] |
Gets the amount of time (mS) the terminate method sleeps between checks for thread termination. More... | |
static int | TerminationTimeout [get, set] |
The amount of time the terminate method will wait for event processing to complete. More... | |
![]() | |
NSFString | Name [get, set] |
![]() | |
NSFId | UniqueId [get] |
Gets or sets the unique id of the object. More... | |
![]() | |
NSFString | Name [get] |
Gets the name of the object. More... | |
Additional Inherited Members | |
![]() | |
static NSFId | getNextUniqueId () |
Gets the next unique id. More... | |
![]() | |
NSFVoidActions < NSFExceptionContext > | ExceptionActions = new NSFVoidActions<NSFExceptionContext>() |
Actions to execute if an exception is encountered while the thread is executing. More... | |
![]() | |
object | threadMutex = new object() |
Represents a thread that has an event queue and dispatches events to their destinations.
NSFEventThread | ( | NSFString | name | ) |
Creates an event thread.
name | The name of the thread. |
The thread is created with medium priority. To change the priority, use the Thread property to access the underlying thread object.
NSFEventThread | ( | NSFString | name, |
int | priority | ||
) |
Creates an event thread.
name | The name of the thread. |
priority | The priority of the thread. |
bool hasEvent | ( | NSFEvent | nsfEvent | ) |
Indicates if the event queue contains an event that matches the specified event.
nsfEvent | The event to match. |
Two events match if they have the same id. Events may be copied to create new events with the same id.
bool hasEventFor | ( | INSFEventHandler | eventHandler | ) |
Indicates if the event queue contains an event for the specified destination.
eventHandler | The event handler destination. |
void queueEvent | ( | NSFEvent | nsfEvent, |
bool | isPriorityEvent, | ||
bool | logEventQueued | ||
) |
Queues the specified event.
nsfEvent | The event to queue. |
isPriorityEvent | Flag indicating if the event should be queued to the back of the queue (false) or the front of the queue (true). |
logEventQueued | Flag indicating if an event queued trace should be added to the trace log. |
void removeEventsFor | ( | INSFEventHandler | eventHandler | ) |
Removes all events for the specified event handler.
eventHandler | The event handler destination. |
|
virtual |
Terminates the thread by causing the thread loop to return.
waitForTerminated | Flag indicating if the method should wait until the event thread is terminated (true), or if it should return immediately (false). |
This method is useful to guarantee that a thread is no longer active, so that it can be garbage collected. If the waitForTerminated flag is set true, this method must not be called from its thread of execution. Before terminating the event thread, this method terminates all event handlers using the thread.
Reimplemented from NSFThread.
|
protectedvirtual |
Implements the main event processing loop.
Implements NSFThread.
|
get |
Gets a list of event handlers using the thread.