Re: Waiting to thread exit
- From: "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp>
- Date: Sun, 9 Sep 2007 11:50:47 -0400
"Sebastian Warmuz" <sebastian@xxxxxxxxxxx> wrote in message news:%23Qol0Jv8HHA.4432@xxxxxxxxxxxxxxxxxxxxxxx
Thx Scott And Joseph.
Sorry for my stupid questions but I already started to learn threads. I made everythign like You said and now everything works fine. But I have only one small problem....
In the method I am creating a therad I have to obtain that thread is finished. This thread will make a backup of some files and after job is done it will continue to lauch application
void CMyApp::OnInitInstance()
{
// 1. init etc,
// 2. make backup in thread displaying progress
// 3. if backup made do the res
}
But the problem is that point 3 is started when backup thread is not yet finished.... How o resolve it ?
No, not "in the method." Windows programs must be event-driven and continue to process messages so the GUI will operate properly. Every method in the main thread must return quickly. So you cannot wait in the main thread until the new thread is finished: This would cause to program to fail to repaint properly and to be labeled "not responding" by Windows.
What we suggested is that you post a message to the main window when the backup copy thread is finished. When you get that messsage then you can "do the res".
.
- References:
- Waiting to thread exit
- From: Sebastian Warmuz
- Re: Waiting to thread exit
- From: Scott McPhillips [MVP]
- Re: Waiting to thread exit
- From: Sebastian Warmuz
- Waiting to thread exit
- Prev by Date: Re: Connection String for SQL Server ???
- Next by Date: Re: Waiting to thread exit
- Previous by thread: Re: Waiting to thread exit
- Next by thread: Re: Waiting to thread exit
- Index(es):
Relevant Pages
|
Loading