C# Class ControlSystem.ThreadHandling

Class to handle all threads in system, everything handled by a unique description tag that stays with a thread from moment it gets added till it gets removed.
Afficher le fichier Open project: syre/SortingIndustrialRobot

Méthodes publiques

Méthode Description
ThreadHandling ( ) : System

Constructor for class : Makes a new list for usage

abortAllAndWait ( ) : void

Functions aborts all threads currently running and waits for them to finish

abortAndWait ( string _description ) : void

Terminates thread with supplied description, then waits for it to finish terminating

addThread ( ParameterizedThreadStart _parameterizedThreadStart, string _description ) : void

Overloaded addThread function, so that it can add threads with a parameterizedThreadStart to a thread list by a description

addThread ( ThreadStart _threadStart, string _description ) : void

addThread function, adds a function as a thread to a list, which needs its own thread for running. This specific function handles ThreadStart parameter, which means it can only take functions with no parameters as argument

find ( string _description ) : ThreadHolder

Function that looks up saved threads by description

removeThread ( string _description ) : void

Removes the specified thread from the thread list (Stops and waits for it to finish if it was running).

start ( string _description ) : void

Starts the thread from supplied description if found.

start ( string _description, object _obj ) : void

Starts the thread from supplied description if found but with a given parameter object

Private Methods

Méthode Description
remakeThread ( ThreadHolder _threadHolder ) : void

Remakes the thread so it can run under same name again.

Method Details

ThreadHandling() public méthode

Constructor for class : Makes a new list for usage
public ThreadHandling ( ) : System
Résultat System

abortAllAndWait() public méthode

Functions aborts all threads currently running and waits for them to finish
public abortAllAndWait ( ) : void
Résultat void

abortAndWait() public méthode

Terminates thread with supplied description, then waits for it to finish terminating
public abortAndWait ( string _description ) : void
_description string Description which the function needs to terminate thread for and wait for
Résultat void

addThread() public méthode

Overloaded addThread function, so that it can add threads with a parameterizedThreadStart to a thread list by a description
public addThread ( ParameterizedThreadStart _parameterizedThreadStart, string _description ) : void
_parameterizedThreadStart ParameterizedThreadStart Parameter is name of function that needs its own thread, as its paramterizedThreadStart, it means it have to be a function with parameter object: (functionname(object example){})
_description string Description which the thread needs to be saved as (unique)
Résultat void

addThread() public méthode

addThread function, adds a function as a thread to a list, which needs its own thread for running. This specific function handles ThreadStart parameter, which means it can only take functions with no parameters as argument
public addThread ( ThreadStart _threadStart, string _description ) : void
_threadStart ThreadStart Parameter is name of function that needs its own thread, as its Threadstart, it means it have to be a function with no parameters: (functionname(){})
_description string Description which the thread needs to be saved as (unique)
Résultat void

find() public méthode

Function that looks up saved threads by description
public find ( string _description ) : ThreadHolder
_description string String that descripes the thread looking for
Résultat ThreadHolder

removeThread() public méthode

Removes the specified thread from the thread list (Stops and waits for it to finish if it was running).
public removeThread ( string _description ) : void
_description string Description which the function need to find the thread that should be deleted
Résultat void

start() public méthode

Starts the thread from supplied description if found.
public start ( string _description ) : void
_description string Description is a string which the function needs to search and find a thread for in a list
Résultat void

start() public méthode

Starts the thread from supplied description if found but with a given parameter object
public start ( string _description, object _obj ) : void
_description string Description is a string which the function needs to search and find a thread for in a list
_obj object An object that needs to be passed on to the thread as start parameter
Résultat void