F
Fraser Baldwin
I have a Windows Form that, on initialization, creates/starts a thread that
runs a long process. When the user clicks the "Next" button on the windows
form I need to wait until the thread is completed and then continue this
what needs to be done. (using a call back function to enable the Next
button when the thread is finished will not work)
Currently I'm using a "While" loop to check the status of the thread. The
problem with the "While" loop is that it is using up too many system
resources to check the status that the thread takes too long to complete.
Is there a way to check the status of a thread and if it is not complete
then put the form to sleep for a few milliseconds to allow the thread to
run?
I've see the Thread.Sleep() method but I can't seem to find a Form.sleep()
method.
And if I start the Windows Form from within a Thread and put it to sleep
will the sub thread (the one I've created on initialization of the Form) go
to sleep as well?
runs a long process. When the user clicks the "Next" button on the windows
form I need to wait until the thread is completed and then continue this
what needs to be done. (using a call back function to enable the Next
button when the thread is finished will not work)
Currently I'm using a "While" loop to check the status of the thread. The
problem with the "While" loop is that it is using up too many system
resources to check the status that the thread takes too long to complete.
Is there a way to check the status of a thread and if it is not complete
then put the form to sleep for a few milliseconds to allow the thread to
run?
I've see the Thread.Sleep() method but I can't seem to find a Form.sleep()
method.
And if I start the Windows Form from within a Thread and put it to sleep
will the sub thread (the one I've created on initialization of the Form) go
to sleep as well?