windows thread function must function as a global or static function (turn)

Call CreateThread (... ) to specify the thread entry function to create a thread is created , this function can only entrance is a static member function of the class or global functions.

Global function is easy to understand, but if it is the class member functions must be static member function, why,

Because the non-static member function calls can only go by object class, but the object class can get when you create a thread away from where the class member function calls it ?

Static member function of all classes, without any special object belongs to a class, it does not create a class of objects can be invoked.

Format global function:
DWORD WINAPI ProcName (LPVOID lpPara) {
}
class static function Format:

DWORD WINAPI ProcName static (LPVOID
lpPara); ----------------
Disclaimer: This article is CSDN blogger "Wei less mvp 'original article, follow the CC 4.0 BY-SA copyright agreement , reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/djb100316878/article/details/45133877

Guess you like

Origin www.cnblogs.com/Stephen-Qin/p/11575356.html