B
Bryce K. Nielsen
I have an object that starts a thread to do a "process". One of the steps
inside this thread launches 12 other threads via a Delegate.BeginInvoke to
process. After these 12 threads are launched, the main thread waits. At the
completion of each subthread, the mainthread checks all 12 thread objects to
see if they are done. If they are, raise an event that says we're done.
So, it's kinda like this:
ProcessThread
- Creates a ProcessObject
- ProcessObject Execute creates a list of 12 SubProcessObjects
- Invokes 12 new SubProcessThreads
- SubProcessObject executes
- SubProcessObject sets a "Completed" flag
- The end routine checks the SubProcessObject list to see if all
"Completed" flags
- If so, raise event to main process to continue to next ProcessObject
Problem is, I don't think the pick-up-on-main-thread is really executing on
the main thread. I think it's continuing to process on the newly created
subthread. Since my class has nothing to do with a Control, I don't have
access to InvokeRequired or Invoke. Is there a way ot make sure my
subthreads really complete?
-BKN
inside this thread launches 12 other threads via a Delegate.BeginInvoke to
process. After these 12 threads are launched, the main thread waits. At the
completion of each subthread, the mainthread checks all 12 thread objects to
see if they are done. If they are, raise an event that says we're done.
So, it's kinda like this:
ProcessThread
- Creates a ProcessObject
- ProcessObject Execute creates a list of 12 SubProcessObjects
- Invokes 12 new SubProcessThreads
- SubProcessObject executes
- SubProcessObject sets a "Completed" flag
- The end routine checks the SubProcessObject list to see if all
"Completed" flags
- If so, raise event to main process to continue to next ProcessObject
Problem is, I don't think the pick-up-on-main-thread is really executing on
the main thread. I think it's continuing to process on the newly created
subthread. Since my class has nothing to do with a Control, I don't have
access to InvokeRequired or Invoke. Is there a way ot make sure my
subthreads really complete?
-BKN