TOMERDR,
You could use a timer which will re-start the process five minutes after
it ends. As for the ability to stop your loop, you could have a flag that
is set on your SyncManager class (or a method), which will cancel the loop.
This will set a flag that is checked in your thread (make sure you lock
access to the flag), and if the flag is true, it stops processing the loop.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"TOMERDR" <to*****@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Hi,
I have a sync manager class which span a thread which run a tight
loop(Sync function)
I would like that after the loop is finished,every 5 minutes the
thread will run again
I want also the ability to stop the thread in the middle of the loop
Is it ok to just use a timer in the SyncManager class?
Thanks in advance
public class SyncManager
{
Thread m_workerThread;
public SyncManager()
{
}
/// <summary>
///
/// </summary>
public Stop()
{
}
/// <summary>
///
/// </summary>
public void Start()
{
m_workerThread= new Thread(new ThreadStart(Sync));
m_workerThread.Name = "Sync";
m_workerThread.IsBackground = true;
m_workerThread.Start();
}
/// <summary>
///
/// </summary>
public void Sync()
{
}