IGLib  1.7.2
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Lib.TrackedThread Class Reference

Tracked thread object that wraps a single created thread and enables that all active wrapped threads are are tracked (i.e. a list of all active tracked threads can be obtained at any time). More...

Public Member Functions

 TrackedThread (ParameterizedThreadStart start)
 Creates a new tracked thread with the specified parameterized thread start delegate. More...
 
 TrackedThread (ThreadStart start)
 Creates a new tracked thread with the specified thread start delegate. More...
 
 TrackedThread (ParameterizedThreadStart start, int maxStackSize)
 Creates a new tracked thread with the specified parameterized thread start delegate and the specified maximal stack size. More...
 
 TrackedThread (ThreadStart start, int maxStackSize)
 Creates a new tracked thread with the specified thread start delegate and the specified maximal stack size. More...
 

Static Public Member Functions

static void Test ()
 Tests and demonstrates the TrackedThread class. More...
 

Protected Member Functions

void StartThreadParameterized (object obj)
 The parameterized start method of the current tracked thread. Calls the delegate that has been passed at creation. More...
 
void StartThread ()
 The parameterized start method of the current tracked thread. Calls the delegate that has been passed at creation. More...
 

Protected Attributes

readonly Thread _thread
 
readonly ParameterizedThreadStart _startParameterized
 Parameterized start delegate, executed on the thread when it starts. More...
 
readonly ThreadStart _start
 Start delegate (nonparameterized), executed on the thread when it starts. More...
 

Static Protected Attributes

static readonly object _lockThreadList = new object()
 Object for locking the list of active traced threads. More...
 
static readonly List
< TrackedThread
_threadList = new List<TrackedThread>()
 The list of active traced threads. More...
 

Properties

Thread Thread [get]
 Gets the thread that is uses in this object. More...
 
bool IsParameterizedStart [get]
 Gets the flag indicating whether the current traced thread uses a parameterized thread start. More...
 
static TrackedThread[] Threads [get]
 Returns the array of all active tracked threads of type TrackedThread. More...
 
static int Count [get]
 Gets the current number of active traced threads. More...
 

Static Private Member Functions

static void DoNothingForFiveSeconds ()
 
static void DoNothingForTenSeconds ()
 
static void DoNothingForSomeTime (object seconds)
 

Detailed Description

Tracked thread object that wraps a single created thread and enables that all active wrapped threads are are tracked (i.e. a list of all active tracked threads can be obtained at any time).

Starting and manipulatin of the wrapped thread is done through the TrackedThread.Thread property.

The TrackedThread.IsParameterizedStart property can be used if the wrapped thread was created with the parameterized thread start delegate.

The static TrackedThread.Threads property returns an array of all TrackedThread objects that have ever been created and wrap active threads (threads that complete are removed from the list).

$A Igor xx;

Constructor & Destructor Documentation

IG.Lib.TrackedThread.TrackedThread ( ParameterizedThreadStart  start)
inline

Creates a new tracked thread with the specified parameterized thread start delegate.

Parameters
startThe ParameterizedThreadStart delegate that is called on thread start.
IG.Lib.TrackedThread.TrackedThread ( ThreadStart  start)
inline

Creates a new tracked thread with the specified thread start delegate.

Parameters
startThe ThreadStart delegate that is called on thread start.
IG.Lib.TrackedThread.TrackedThread ( ParameterizedThreadStart  start,
int  maxStackSize 
)
inline

Creates a new tracked thread with the specified parameterized thread start delegate and the specified maximal stack size.

Parameters
startThe ParameterizedThreadStart delegate that is called on thread start.
maxStackSizeMaximal stack size of the thread.
IG.Lib.TrackedThread.TrackedThread ( ThreadStart  start,
int  maxStackSize 
)
inline

Creates a new tracked thread with the specified thread start delegate and the specified maximal stack size.

Parameters
startThe ThreadStart delegate that is called on thread start.
maxStackSizeMaximal stack size of the thread.

Member Function Documentation

void IG.Lib.TrackedThread.StartThreadParameterized ( object  obj)
inlineprotected

The parameterized start method of the current tracked thread. Calls the delegate that has been passed at creation.

Parameters
objObject that is passed as argument to the delegate that is called on thread start.
void IG.Lib.TrackedThread.StartThread ( )
inlineprotected

The parameterized start method of the current tracked thread. Calls the delegate that has been passed at creation.

static void IG.Lib.TrackedThread.Test ( )
inlinestatic

Tests and demonstrates the TrackedThread class.

References IG.Lib.TrackedThread.Count, and IG.Lib.TrackedThread.Thread.

static void IG.Lib.TrackedThread.DoNothingForFiveSeconds ( )
inlinestaticprivate
static void IG.Lib.TrackedThread.DoNothingForTenSeconds ( )
inlinestaticprivate
static void IG.Lib.TrackedThread.DoNothingForSomeTime ( object  seconds)
inlinestaticprivate

Member Data Documentation

readonly Thread IG.Lib.TrackedThread._thread
protected
readonly ParameterizedThreadStart IG.Lib.TrackedThread._startParameterized
protected

Parameterized start delegate, executed on the thread when it starts.

readonly ThreadStart IG.Lib.TrackedThread._start
protected

Start delegate (nonparameterized), executed on the thread when it starts.

readonly object IG.Lib.TrackedThread._lockThreadList = new object()
staticprotected

Object for locking the list of active traced threads.

readonly List<TrackedThread> IG.Lib.TrackedThread._threadList = new List<TrackedThread>()
staticprotected

The list of active traced threads.

Property Documentation

Thread IG.Lib.TrackedThread.Thread
get

Gets the thread that is uses in this object.

Referenced by IG.Lib.TrackedThread.Test().

bool IG.Lib.TrackedThread.IsParameterizedStart
get

Gets the flag indicating whether the current traced thread uses a parameterized thread start.

TrackedThread [] IG.Lib.TrackedThread.Threads
staticget

Returns the array of all active tracked threads of type TrackedThread.

Use the TrackedThread.Thread property on the elements of the returned array in order to manipulate individual tracked threads.

int IG.Lib.TrackedThread.Count
staticget

Gets the current number of active traced threads.

Referenced by IG.Lib.TrackedThread.Test().


The documentation for this class was generated from the following file: