c#2, vs2005
hello
i have say 5 threads running
there running a instance of the same class
so there is 5 executetasks
sample example
//this is a method of 1 thread there are 5 of these running in there own
thread
public void executetask()
{
while (_ServiceRunning)
{
try
{
if (oProcess.WorkToDo())
{
oprocess.Execute() ; // goes into process does its job no
loops and returns, oProcess has its own error handler, therefor it will do
clean up and return here
}
else
{
thread.Sleep(AppConfig.SleepSeconds*1000);
}
}
catch(Exeception ex)
{
//this loop is the top most loop..so any errors at this level are
fatal errors ie sql connection...somthing else went wrong, disk io, etc
// instead of this catch block i would like to to have a predefined
event that calls a method to handle the service ...for instance
//if the error is a sql connection error
// dont stop service try to re-connect 3 times and if not stop the
service
// any examples of how to trigger a event to call a method is very
helpful
}
}
}
thanks