WaitForSingleObject(), the Win32 API call, can be used to wait on a thread
handle (you'll have to get the handle, of course). For multiple threads,
you could also P/Invoke WaitForMultipleObjects().
thread.Join() is the usual way to wait for thread to exit...
Paul T.
"jeff" <(E-Mail Removed)> wrote in message
news:E28EC662-5F3B-462B-8830-(E-Mail Removed)...
> Hi Guys
>
> There is a couple of threads run on my application.
> before I quit the main process, i want to stop all the thread,
> and then quit main process.
>
> I have set some flag to stop my thread,
> something like
>
> void run()
> {
> while(!stop){
> .....
> }
> }
>
> but what I want to double-confirm is :
>
> void quit(){
> waitfortermation(firstThread);//kind of
> waitfortermation(secodThread);//kind of
> ....
> }
> Can I implement some function like this?
|