Indy 9
TIdThreadComponent
Hierarchy, Properties, Methods, See Also, Unit: IdThreadComponent
Implements a visual component using a thread of execution.
TIdThreadComponent = class(TIdCustomThreadComponent)
Unit
IdThreadComponent
Description
TIdThreadComponent is a TIdCustomThreadComponent descendant that exposes properties and event handlers from the ancestor class that reference the protected thread for the component. Read and write access for properties that reference the protected thread are delegated to the internal TIdThread instance.

Event handlers published in TIdThreadComponent are provided to the internal thread instance to allow event notifications and synchronization during thread execution.


TIdThreadComponent.Active
TIdThreadComponent, See Also
Indicates the internal thread is running and has not been Stopped.
property Active;
Description
Active is a Boolean property that is published in TIdThreadComponent, and indicates when the internal thread for the component is running and has not been Stopped. Changing the value in Active will result in a call to the Start method for the internal thread when Active is True. A call to the Stop method for the internal thread is made when Active is False. The read value for Active is True when the internal thread is not Stopped.

Note: At design-time, the value for Active does not examine the state of the internal thread since it is not started or stopped in the IDE.


TIdThreadComponent.OnAfterExecute
TIdThreadComponent, See Also
Event handler signalled when the internal thread has completed.
property OnAfterExecute;
Parameters
Sender
Threaded component for the event notification.
Description
OnAfterExecute is a published TIdNotifyThreadComponentEvent property in IdThreadComponent that represents the event handler used to signal completion of the internal thread. OnAfterExecute is triggered using the component context in Sender when the internal thread performs its AfterExecute method.

Applications must assigned a procedure to the event handler to allow responding to the event notification.


TIdThreadComponent.OnAfterRun
TIdThreadComponent, See Also
Indicates that thread execution has been Stopped, but may be Resumed.
property OnAfterRun;
Parameters
Sender
Threaded component for the event notification.
Description
OnAfterRun is a published TIdNotifyThreadComponentEvent property in IdThreadComponent that represents the event handler used to signal that execution of the internal thread has been stopped, but the thread is still running. OnAfterRun is triggered using the component context in Sender when the internal thread performs its AfterRun method. OnAfterRun occurs prior to CleanUp and AfterExecute for the internal thread.

Applications must assigned a procedure to the event handler to allow responding to the event notification.


TIdThreadComponent.OnBeforeExecute
TIdThreadComponent, See Also
Indicates the thread is about to enter the inner control loop.
property OnBeforeExecute;
Parameters
Sender
Threaded component for the event notification.
Description
OnBeforeExecute is a published TIdNotifyThreadComponentEvent property in TIdThreadComponent that represents the event handler used to signal that the internal thread is about to begin running in the inner control loop. OnBeforeExecute is triggered using the component context in Sender when the internal thread performs its BeforeExecute method. OnBeforeExecute occurs prior to the TIdThread.BeforeRun method and both the OnBeforeRun and OnRun event handlers.

Applications must assigned a procedure to the event handler to allow responding to the event notification.

Use OnAfterExecute to perform application specific processing required when the thread has been completed in it's entirety.


TIdThreadComponent.OnBeforeRun
TIdThreadComponent, See Also
Indicates the thread is about an iteration in the inner control loop.
property OnBeforeRun;
Parameters
Sender
Threaded component for the event notification.
Description
OnBeforeRun is a published TIdNotifyThreadComponentEvent property in TIdThreadComponent that represents the event handler used to signal that the thread is about to perform an iteration in the inner control loop. OnBeforeRun is triggered using the component context in Sender when the internal thread performs its BeforeRun method. OnBeforeRun occurs prior to the TIdThread.Run method and the OnRun event handler.

Applications must assigned a procedure to the event handler to allow responding to the event notification.

Use OnAfterRun to perform application specific processing required when the thread has completed an iteration in the inner control loop.


TIdThreadComponent.OnCleanup
TIdThreadComponent, See Also
Event handler for thread teardown after execution.
property OnCleanup;
Parameters
Sender
Threaded component for the event notification.
Description
OnCleanup is a published TIdNotifyThreadComponentEvent property in TIdThreadComponent that represents the event handler signalled after the internal thread instance for the component performs it CleanUp method. OnCleanup is executed just prior to the TIdThread.AfterExecute method and the OnAfterExecute event handler.

OnCleanup is triggered by the internal thread instance using the component context in Sender.


TIdThreadComponent.OnException
TIdThreadComponent, See Also
Event handler for an exception raised during internal thread execution.
property OnException;
Parameters
AException
Exception raised during execution of the internal thread.
Sender
Threaded component for the exception handler.
Description
OnException is a published TIdExceptionThreadComponentEvent property that represents the event handler signalled when an exception occurs during execution of the internal thread for the component. OnException is triggerd from TIdThread.OnException using the component context in Sender. AException is the exception raised from the control loop in TIdThread.Execute.

TIdThreadComponent.OnRun
TIdThreadComponent, See Also
Event handler signalled when the internal thread is Run.
property OnRun;
Parameters
Sender
Threaded component for the event notification.
Description
OnRun is a published TIdNotifyThreadComponentEvent property in TIdThreadComponent that represents the event handler signalled when the internal thread is Run. OnRun is triggered from the TIdThread.Run method using the component context in Sender.

TIdThreadComponent.OnStopped
TIdThreadComponent
Event handler triggered when the internal thread is stopped.
property OnStopped;
Description
OnStopped is a published TIdNotifyThreadComponentEvent property in TIdThreadComponent that represents the event handler signalled when execution of the internal thread for the component has been stopped.

OnStopped is triggered after entering the control loop in TIdThread.Execute, and when TIdThread.Stopped contains the value True. If the internal thread has also been Terminated, the control loop is exited and the thread calls AfterExecute.


TIdThreadComponent.OnTerminate
TIdThreadComponent, See Also
Event handler triggered when the internal thread is Terminated.
property OnTerminate;
Description
OnTerminate is a published TIdNotifyThreadComponentEvent property in TIdThreadComponent that represents the event handler signalled when the internal thread for the component is Terminated. OnTerminate is triggered as a result of calling TIdThread.Terminate to exit the control loop in TIdThread.Execute.

TIdThreadComponent.Priority
TIdThreadComponent, See Also
Indicates the relative scheduling priority for the internal thread.
property Priority;
Description
Priority is a published TIdThreadPriority property in TIdThreadComponent that indicates the relative scheduling priority of the internal thread instance for the component. Read and write access to value in Priority is delegated to the internal thread instance.

Priority can be changed request or release CPU cycles during thread execution. Warning: Boosting the thread priority of a CPU intensive operation may “starve” the other threads in the application. Only apply priority boosts to threads that spend most of their time waiting for external events.


TIdThreadComponent.StopMode
TIdThreadComponent, See Also
Indicates the action to be taken when the internal thread is Stopped.
property StopMode;
Description
StopMode is a published TIdThreadStopMode property in TIdThreadComponent that indicates the action when the internal thread contains True in the Stopped property. StopMode is updated when the internal thread calls its Stop method.

Read and write access to the value in StopMode is delegated to the internal thread instance for the component.


Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.