当前位置: 技术问答>linux和unix
为什么多线程调用不成?wwwunix和blh快来看啊!!
来源: 互联网 发布时间:2014-12-15
本文导语: void print_message(void* ptr) { ........ } int main() { pthread_t thead; char* pMessage = "hello!"; pthread_create(&thread,NULL,(void*)print_message,(void*)pMessage); } 编译老是出错!说第三个参数不符,(void*)cann't convert to(void*...
void print_message(void* ptr)
{
........
}
int main()
{
pthread_t thead;
char* pMessage = "hello!";
pthread_create(&thread,NULL,(void*)print_message,(void*)pMessage);
}
编译老是出错!说第三个参数不符,(void*)cann't convert to(void*)(*)(void*)
,(void*)&print_message,也不行,大家看看!
{
........
}
int main()
{
pthread_t thead;
char* pMessage = "hello!";
pthread_create(&thread,NULL,(void*)print_message,(void*)pMessage);
}
编译老是出错!说第三个参数不符,(void*)cann't convert to(void*)(*)(void*)
,(void*)&print_message,也不行,大家看看!
|
void * print_message(void* ptr)
{
........
}
int main()
{
pthread_t thead;
char* pMessage = "hello!";
pthread_create(&thread,NULL,(void*(*)(void*))print_message,(void*)pMessage);
}
{
........
}
int main()
{
pthread_t thead;
char* pMessage = "hello!";
pthread_create(&thread,NULL,(void*(*)(void*))print_message,(void*)pMessage);
}