如何线程调用C++类成员函数

方法就是:

1,写成静态成员函数

2,参数为 (void* __this)用来传入类 对象指针(this)

3,进入函数首先    C类名 *_this = (C类名*)__this;  转化为对象指针

4,之后用_this调用类成员变量和方法就行了

5,CreateThread开启线程方法第三个参数传入该静态函数

      CreateThread第四个参数传入对象指针this

 

posted on 2018-11-22 16:45  J·Marcus  阅读(2672)  评论(0)    收藏  举报

导航