G
Graham Allwood
Hi,
I have a windows forms application that starts a background thread when it
loads. The background thread is intended to load some data from a database,
this data is required later on in the app (say on some menu option being
chosen). Now, if this menu option is chosen I check the state of the
background thread and if it is still running I want to wait until it
finishes.
Can someone tell is it is ok use the following to pause the UI whilst the
background thread finishes:
myBackgroundThreadAsyncResult.AsyncWaitHandle.WaitOne();
Or is there a better way of waiting for this thread to finish. Perhaps using
Join() from the UI thread?
Any comments?
Regards
Graham
I have a windows forms application that starts a background thread when it
loads. The background thread is intended to load some data from a database,
this data is required later on in the app (say on some menu option being
chosen). Now, if this menu option is chosen I check the state of the
background thread and if it is still running I want to wait until it
finishes.
Can someone tell is it is ok use the following to pause the UI whilst the
background thread finishes:
myBackgroundThreadAsyncResult.AsyncWaitHandle.WaitOne();
Or is there a better way of waiting for this thread to finish. Perhaps using
Join() from the UI thread?
Any comments?
Regards
Graham