P
Pixel.to.life
Dear All,
Here is a problem I am facing (it might be too simple, but then I
admit I am not a Guru
I have a main thread, in managed C++, that deals with displaying a
form and some controls.
I invoke another thread for some processing from this thread, so
basically the main thread is waiting on the sub thread.
Now the sub-thread has to keep posting its progress to the main
thread. I have a delegate mechanism for that. So using mutex, I update
the progress variable in the sub-thread's scope, and then invoke the
main thread's delegate method to display the progress.
The problem is just when the delegate is invoked. Control switches
form sub to main thread. But main thread is already waiting for the
sub thread to finish, so it deadlocks right there.
Any ideas/suggestions? The solution seems simple, just that I dont get
it yet.
Thanks!
Here is a problem I am facing (it might be too simple, but then I
admit I am not a Guru
I have a main thread, in managed C++, that deals with displaying a
form and some controls.
I invoke another thread for some processing from this thread, so
basically the main thread is waiting on the sub thread.
Now the sub-thread has to keep posting its progress to the main
thread. I have a delegate mechanism for that. So using mutex, I update
the progress variable in the sub-thread's scope, and then invoke the
main thread's delegate method to display the progress.
The problem is just when the delegate is invoked. Control switches
form sub to main thread. But main thread is already waiting for the
sub thread to finish, so it deadlocks right there.
Any ideas/suggestions? The solution seems simple, just that I dont get
it yet.
Thanks!