linux之pthread_create实现类的成员函数做参数
在C++的类中,普通成员函数不能作为pthread_create的线程函数,如果要作为pthread_create中的线程函数,必须是static !
在C语⾔中,我们使⽤pthread_create创建线程,线程函数是⼀个全局函数,所以在C++中,创建线程时,也应该使⽤⼀个全局函数。
static定义的类的成员函数就是⼀个全局函数。
linux中pthread_create实现类的成员函数做参数
最新推荐文章于 2024-04-18 19:48:36 发布