Bonjour tout le monde,
j'ai 1 thread qui fait du acquisition des donn�es,
et quand je ferme la fenetre, je voudrais arreter le thread, mais il reste bloquer une fois sur 30.
donc quand je ferme la fenetre, la OnDestroy est cens� stoper le thread, mais il reste bloquer de temps en temps sur la ligne :
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 DWORD WINAPI Thread_2(LPVOID lpParam) { . hEvent[0] = hStopEventReadPoint; hEvent[1] = hStartEventReadPoint; while(1) { iCode = WaitForMultipleObjects(2,hEvent,FALSE, INFINITE); if(iCode == WAIT_OBJECT_0) { ResetEvent(hStopEventReadPoint); break; } else { ..... //traitement m_StaticMessageDef.SetWindowText(str); //CStatic m_StaticMessageDef; <-------- ca bloque ici } } } void DialogData::OnDestroy() { /* ==== Fermerture de thread d'acquisition des flux ==== */ if (hStopEventReadPoint) { SetEvent(hStopEventReadPoint); WaitForMultipleObjects(1, &hThread_ReadLastPointOfMAGChannel, TRUE, INFINITE); } CDialog::OnDestroy(); }
-"m_StaticMessageDef.SetWindowText(str)" dans le thread
-"WaitForMultipleObjects" dans le OnDestroy.
j'ai un pros centrino inter Duo
pourquoi reste t-il bloquer sur les ressources de windows? et comment corriger ce probleme svp ?
Partager