DoEvents() "Hangs"
- From: cedmunds@xxxxxxx
- Date: 3 Aug 2006 12:06:36 -0700
Group:
We have an application that is calling a stored proc. The stored proc
takes anywhere from 15 to 90 minutes to run.
In order to keep the GUI responsive, we are using a BackgroundWorker to
actually make the call to the stored proc. The app then sits in a loop
that awakes every second and updates an elapsed time value.
The problem that we are having is that after a certain period of time -
which is rarely the same amount - the call to DoEvents hangs (does not
return).
I was hoping the group could help us with: a) why thiat might be
occuring and b) what if anything can be done to fix it.
Here's the key areas of the code:
This is from the method that starts the ball rolling:
.
.
.
case "Consolidate Revenue": {
bgwThread.RunWorkerAsync( cConsolidateRevenue );
SleepAndUpdate();
break;
}
.
.
.
This is from the "DoWork" event handler:
private void bgwThread_DoWork( object sender, DoWorkEventArgs e ) {
switch ((int)e.Argument) {
case cConsolidateRevenue: {
ConsolidateRevenue( cn, dtPickerStartDate.Value.Date,
dateImportEndDate );
break;
}
.
.
.
Here is SleepAndUpdate:
private void SleepAndUpdate( ) {
while (notDone) {
ShowElapsedTime();
Application.DoEvents();
System.Threading.Thread.Sleep( 1000 );
}
}
We have verfied that the app is indeed haning on the call to DoEvents()
Thank you for your help
.
- Follow-Ups:
- Re: DoEvents() "Hangs"
- From: Greg Young
- Re: DoEvents() "Hangs"
- From: C# MVP
- Re: DoEvents() "Hangs"
- Prev by Date: Re: OleDB : ORDER BY 's order.
- Next by Date: Getting data from objects C#
- Previous by thread: OleDB : ORDER BY 's order.
- Next by thread: Re: DoEvents() "Hangs"
- Index(es):
Relevant Pages
|
Loading