Bonjour,

Voici la classe que j'utilise pour gérer mes threads :
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
42
43
44
45
46
47
48
//------------------------------------------------------------------------------
// Implement an MFC based thread
//------------------------------------------------------------------------------
 
#ifndef _THREAD_H_
#define _THREAD_H_
 
 
#include "Afxmt.h"                  // Windows MFC for CEvent
 
 
 
 
 
class CThread
{
 
public:
 
    CThread(void);
    ~CThread(void);
 
    // Call this to change the priority of the thread
    BOOL SetPriority(int iNewPriority);
 
    // Call this to register a callback function
    void CallThis(void (*CallbackFunction)(void *pContext));
 
    // Call this to awake the thread and the callback function will be called
    BOOL AwakeThread(void *pTheContext);
 
private:
 
    CWinThread  *m_pTheThread;          // MFC wrapped thread
    CEvent      *m_pEvtWakeUpThread;    // Event used to call the user's callback
    CEvent      *m_pEvtThreadActive;    // Event used to terminates the thread
 
    BOOL        m_bThreadBusy;          // Callback function has returned
 
    void (*m_pUserCallback)(void *pContext);    // Ptr 2 user function to call
    void *m_pUserContext;                       // Ptr 2 user context as the callback function parameter
 
    static UINT TheThreadFunc(LPVOID pThreadFuncParam);
 
};
 
 
#endif	// _THREAD_H_
Pour lancer mon thread, j'utilise ce code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
// Start the acquisition thread
 
    m_apAcqThread[0]->AwakeThread(&m_aAcqThreadParams[0]);
avec

Code : Sélectionner tout - Visualiser dans une fenêtre à part
CThread             *m_apAcqThread[MAX_NUMBER];
Comment puis je savoir que le Thread a terminé sa tâche?

Merci d'avance.