小编Tha*_*iJo的帖子

pthread_create - 无效使用非静态成员函数

我一直在努力学习如何使用线程,而且我一直在努力创建线程.我正在这样的类构造函数中创建线程...

Beacon::Beacon() {
    pthread_create(&send_thread,NULL, send, NULL);
}
Run Code Online (Sandbox Code Playgroud)

发送功能还没有做任何事情,但这就是它的样子.

void Beacon::send(void *arg){
    //Do stuff
}
Run Code Online (Sandbox Code Playgroud)

每次运行代码时,我都会无效使用非静态成员函数错误.我尝试过使用和发送,但是没有用.我也设置了最后一个NULL参数,但是没有用.我一直在寻找其他示例代码来尝试和模仿它,但似乎没有任何工作.我究竟做错了什么?

c++ pthreads

3
推荐指数
1
解决办法
4438
查看次数

标签 统计

c++ ×1

pthreads ×1