C
Curious
Hi,
It turns out that I must start a new thread from an existing thread
that was started from a timer.
In other words, the relations are described in the code below:
void Main()
{
mTimer = new Timer(new TimerCallback(CheckHistoricalData), null,
15000, 15000);
}
// Callback for the timer
void CheckHistoricalData(object state)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(GetCashByList), null);
// Code omitted here
}
void GetCashByList(object o)
{
// Code omitted here
if (cashR.CashForToday <= cashR.LowerBound)
{
// Start a new thread to display messagebox
// Pass both list and cash for sector
ThreadPool.QueueUserWorkItem(new WaitCallback
(ShowSectorCashMessage), cashR);
}
}
I'm concerned that my program may crash because each thread is at a
different level and there are so many levels of threads. Anyone can
advice me if this is safe? Is there anything I can do to make the
program robust?
It turns out that I must start a new thread from an existing thread
that was started from a timer.
In other words, the relations are described in the code below:
void Main()
{
mTimer = new Timer(new TimerCallback(CheckHistoricalData), null,
15000, 15000);
}
// Callback for the timer
void CheckHistoricalData(object state)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(GetCashByList), null);
// Code omitted here
}
void GetCashByList(object o)
{
// Code omitted here
if (cashR.CashForToday <= cashR.LowerBound)
{
// Start a new thread to display messagebox
// Pass both list and cash for sector
ThreadPool.QueueUserWorkItem(new WaitCallback
(ShowSectorCashMessage), cashR);
}
}
I'm concerned that my program may crash because each thread is at a
different level and there are so many levels of threads. Anyone can
advice me if this is safe? Is there anything I can do to make the
program robust?