Thread function

Thread function parameters is not this a pointer parameter. The default function in the class will be added at the end of this pointer parameter does not meet the requirements of thread function.

Global function (function outside the class), static static function can be modified to eliminate this pointer added by default.

Therefore, the thread function class put domestic demand plus static modification, or placed directly outside class .

Note: static member function implementation time no need to increase the static keyword, otherwise it is wrong outside of class.

For example, * h header file, put the thread function class is written static void MyThreadFunctioon ();

* .Cpp in the corresponding written as void class name :: MyThreadFunctioon ();

【reference】

Why class thread function must be declared static?

c / c ++ base (24) static properties and static methods

Guess you like

Origin www.cnblogs.com/xixixing/p/12061516.html