(1) createthread Function
Createthread: it is a Windows API function (standard form of SDK function, straightforward creation method, which can be used in any situation), and provides operations for creating threads at the operating system level,AndLimited to worker threads. Createthread can be used when you do not call MFC or RTL functions. Do not use it in other cases..Because:
In C RuntimeMultithreading is requiredRecord and initializationTo ensure that the C function library works properly.
MFCYou also need to know how to create a new thread.InitializationWork.
Some CRT functions include malloc (), fopen (), _ open (), strtok (), ctime (), or localtime ().SpecialData blocks locally stored by threads, ThisData blocks usually need to be created when a thread is created.,If createthread is used, this data block is not created.,The function will create one by itself and associate it with the thread. This means that if you use createthread to create a thread and then use such a functionOne piece exists and is created without knowing itAnd these functions are not deleted,And createthread and exitthread cannot know about it.So there will be memory
Leak (Memory leakage) will consume system memory resources sooner or later in software with frequent thread startup.
(2) _ beginthreadex Function
_ Beginthreadex: Extended SDK function of MS for C Runtime library,First, we initialize the C Runtime Library to ensure that the C Runtime Library works normally. Then, call createthread to create a thread.
(3) afxbeginthread Function
Afxbeginthread: the MFC function created by the thread in MFC. First, the corresponding cwinthread object is created, and then cwinthread: createthread is called. In cwinthread: createthreadInitialize the thread object. Then, call _ beginthreadex (afxbeginthread is safer) to create a thread.. It makesA thread can respond to messages and be used by interface threads or worker threads.
Note:
Afxbeginthread: In MFC, the worker thread/interface thread
_ Beginthreadex: it is used to call the C Runtime Library, but cannot be used in MFC.
Createthread: The worker thread, which cannot be used in MFC and cannot be used in C runtime. So it is best not to use it at any time.
Afxbeginthread_beginthreadexcreatethread