Click here to Skip to main content
15,076,130 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionproblem in triggering events Pin
rajeev8227-Apr-06 0:00
Memberrajeev8227-Apr-06 0:00 
AnswerRe: problem in triggering events Pin
Cedric Moonen27-Apr-06 0:12
MemberCedric Moonen27-Apr-06 0:12 
AnswerRe: problem in triggering events Pin
Roger Stoltz27-Apr-06 0:34
MemberRoger Stoltz27-Apr-06 0:34 
GeneralRe: problem in triggering events Pin
rajeev8227-Apr-06 0:54
Memberrajeev8227-Apr-06 0:54 
AnswerRe: problem in triggering events Pin
Roger Stoltz27-Apr-06 1:00
MemberRoger Stoltz27-Apr-06 1:00 
GeneralRe: problem in triggering events Pin
rajeev8227-Apr-06 1:19
Memberrajeev8227-Apr-06 1:19 
AnswerRe: problem in triggering events Pin
Roger Stoltz27-Apr-06 2:50
MemberRoger Stoltz27-Apr-06 2:50 
QuestionWaiting for the thread end Pin
gomez_a26-Apr-06 23:44
Membergomez_a26-Apr-06 23:44 
(VS 2005 MFC) I have a list of 5 threads, for example:

struct T_PARAMS
{
HWND hWnd; // a handle to dialog window, using in thread
};

int thread_count = 5; // I have 5 threads
CWinThread *pThread; // pointer to thread
CList<cwinthread*, cwinthread*=""> mList; // list of the pointers to threads
int lp = 0;

// First I create 5 stopped threads:
for(lp = 0; lp < thread_count; lp++)
{
params = new T_PARAMS();
params->hWnd = m_hWnd;
pThread = AfxBeginThread(ThreadFunc, params, THREAD_PRIORITY_NORMAL, 0,
CREATE_SUSPENDED);
pThread->m_bAutoDelete = true;

mList.AddTail(pThread);
}

Now, when I have a list of pointers to threads, I want run threads, but I want to do it in this way: run first thread (mList[0]), wait so long how the first thread is working, next run second thread (mList[1]) and so on. For example:

POSITION pos;
CWinThread *wsk = NULL;

pos = mList.GetHeadPosition();
for(lp = 0; lp < thread_count; lp++)
{
wsk = (CWinThread *) mList.GetNext(pos);
wsk->ResumeThread();
// [*] now wait until thread is working - how to do it?
}

My threads are working properly, I use one semaphor to allow works only 1 thread at once, but I don't know how can I do - in line [*], that programm will wait after wsk->ResumeThread() until this thread is finished his work?

Regards
mwgomez
Poland
AnswerRe: Waiting for the thread end Pin
Roger Stoltz27-Apr-06 0:38
MemberRoger Stoltz27-Apr-06 0:38 
AnswerRe: Waiting for the thread end Pin
Stephen Hewitt27-Apr-06 0:41
MemberStephen Hewitt27-Apr-06 0:41 
Questionhow to write a log file Pin
vuyyuru26-Apr-06 22:50
Membervuyyuru26-Apr-06 22:50 
AnswerRe: how to write a log file Pin
Cedric Moonen26-Apr-06 22:54
MemberCedric Moonen26-Apr-06 22:54 
GeneralRe: how to write a log file Pin
vuyyuru27-Apr-06 1:53
Membervuyyuru27-Apr-06 1:53 
GeneralRe: how to write a log file Pin
Cedric Moonen27-Apr-06 2:02
MemberCedric Moonen27-Apr-06 2:02 
GeneralRe: how to write a log file Pin
kakan27-Apr-06 2:48
professionalkakan27-Apr-06 2:48 
QuestionCreating/Deleting Directories in Windows (no .nET) Pin
chasetoys26-Apr-06 22:47
Memberchasetoys26-Apr-06 22:47 
AnswerRe: Creating/Deleting Directories in Windows (no .nET) Pin
kakan26-Apr-06 23:41
professionalkakan26-Apr-06 23:41 
AnswerRe: Creating/Deleting Directories in Windows (no .nET) Pin
Michael Dunn27-Apr-06 19:58
sitebuilderMichael Dunn27-Apr-06 19:58 
Questionconvert from char a[MAX_PATH] to LPCWSTR Pin
gbabu1726-Apr-06 22:25
Membergbabu1726-Apr-06 22:25 
AnswerRe: convert from char a[MAX_PATH] to LPCWSTR Pin
Nibu babu thomas26-Apr-06 22:31
MemberNibu babu thomas26-Apr-06 22:31 
GeneralRe: convert from char a[MAX_PATH] to LPCWSTR Pin
gbabu1726-Apr-06 22:50
Membergbabu1726-Apr-06 22:50 
GeneralRe: convert from char a[MAX_PATH] to LPCWSTR Pin
Nibu babu thomas26-Apr-06 22:53
MemberNibu babu thomas26-Apr-06 22:53 
GeneralRe: convert from char a[MAX_PATH] to LPCWSTR Pin
Cedric Moonen26-Apr-06 22:56
MemberCedric Moonen26-Apr-06 22:56 
GeneralRe: convert from char a[MAX_PATH] to LPCWSTR Pin
Hamid_RT27-Apr-06 2:06
MemberHamid_RT27-Apr-06 2:06 
GeneralRe: convert from char a[MAX_PATH] to LPCWSTR Pin
David Crow27-Apr-06 5:54
MemberDavid Crow27-Apr-06 5:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.