[英]C++ Spawning threads
您好,我需要正确生成线程的帮助,我似乎无法正确获取语法。 这是我的代码...
// Spawn a thread--------------------------------------------------#
pthread_t thread1; // thread object
int rc1;
if( (rc1=pthread_create( &thread1, NULL, spellCheck, NULL)) )
{
cout << "Thread creation failed: " << rc1 << endl;
}
pthread_join( thread1, NULL);
功能定义
void spellCheck(vector<string> * fileRead, list<string> * incorrectWord, vector<string> * correctWord)
{
头文件
void spellCheck(vector<string> *fileRead, list<string> *incorrectWord, vector<string> *correctWord);
任何帮助将非常感激 :)
我的错误:
server.cpp:142: error: invalid conversion from 'void ()(std::vector<std:................. initializing argument 3 of 'int pthread_create(pthread_t, const pthread_attr_t*, void* ()(void), void*)'
我在这里可能是错的,但我认为您实现并传递给pthread_create()的线程函数只能有一个(void *)输入参数
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.