tsc_IEventMonitor

Like other monitor classes, this class provides the means to handle events.  In the case of tsc_IEventMonitor, the only event handled is a custom event which has been generated elsewhere within the plugin.  

Available in TASDK version 1.90 and higher.

Important: While this class may be used to handle a single event type, it is recommended that the tsc_Event and tsc_EventDelegate classes be used instead, since they allow multiple events per handler class and multiple handlers to subscribe to the same event.  tsc_Event also supports synchronous event handling where the event producer blocks until the handler(s) have completed processing the event.  tsc_EventDelegate is a wrapper for tsc_IEventMonitor.

The main purpose of tsc_IEventMonitor is for passing asynchronous events (messages) to the same or a different thread.

Public methods

void Start();
Starts receiving events raised on this monitor. Always qualify calls to this function, as in tsc_IEventMonitor::Start().  Event handlers will only be called on the thread that called start.

void Stop ();
Stop receiving events for this monitor. Always qualify calls to this function, as in tsc_IEventMonitor::Stop(). Stop must be called on the same thread that called Start.

void RaiseEvent (tsc_EventArgs* eventArgs);
Queues an event to be passed to OnEvent(). Control returns immediately, and the event handler will be called when the thread that started the monitor is idle. eventArgs is passed to the OnEvent handler, and may be NULL.  It is the caller's responsibility to ensure that the eventArgs object is not destroyed before the handler receives it; see the page for tsc_EventArgs for more information.

RaiseEvent may be called from any thread. If RaiseEvent is called on the same thread as the event handler thread (the thread that called Start) then OnEvent is called inline immediately.  Otherwise the event is queued to the event handler's thread.

virtual void OnEvent (tsc_EventArgs* eventArgs);
Receives events which were sent using RaiseEvent(), in the sequence they were sent.  The eventArgs pointer is the pointer that was passed into RaiseEvent, and may be NULL.  As with all monitors, the handler function will only be called when the thread is in a wait within the API.