-1
在一個類中,當我嘗試創建一個線程像這樣的方法:C++多線程
void *RippleBrush::paintRippleOnce(void){
while(1){
for (int j = 0; j < height; j ++) {
for(int i = 0; i < width; i ++){
int point = j * height + i;
data[point].a += ripple->rippleNow[point];
ripple->CaculateNextRipple();
}
}
}
}
void RippleBrush::paintRipple(){
pthread_t ctrl_thread;
if(pthread_create(&ctrl_thread, NULL, RippleBrush::paintRippleOnce, NULL) != 0){
perror("pthread_create");
exit(1);
}
}
它顯示錯誤:調用「在pthread_create」沒有匹配的功能。
如何在同一個類中的另一個方法創建一個方法的線程?
謝謝!但是如何編寫一個void *(* start_routin)(void *)的例子。我知道如何在main.cpp中完成它,但是我無法在其他class.cpp中完成它。 – David
你得到了什麼錯誤? – ardhitama