Multithreaded programming, there are different multithreaded methods under different programming languages or libraries.
such as PThread under MFC = AfxBeginThread (Mythread2, (LPVOID) this, NULL); Not very useful.
The following is the C + + standard library of multi-threaded programming methods, multithreaded programming is generally associated with the signal, through the signal to determine the thread start, suspend, restart, shutdown and so on.
There are several functions that are mainly
1. Create a signal Handle hevent = CreateEvent (null,true,true,null);
2. Create a thread Handle hthread = CreateThread (NULL, 0, Initthreadproc, this, 0, &m_dwthreadid);
3, SetEvent (m_hevent); set signal, signal status
4, ResetEvent (m_hevent); reset signal, no signal status
5. Dword dwstatus = WaitForSingleObject (m_hevent, INFINITE); Wait for a signal, ininite indefinitely wait until there is a signal to accept, return; If 0, return immediately.
6, Colsehandle (m_hthread);//close a thread.
7, GetExitCodeThread (M_hthread, &dwcode); Gets the exit code for a terminated thread, not 0 for success, 0 for failure, and GetLastError ().
The class can also set some parameters when the class's local variables are used by the class.
Basically, C + + multithreaded programming is so much, in short, the connection between thread and signal use, changeable.
Threading issues encountered during C + + development