Dan*_*ore 2 c++ multithreading posix
你好,我需要一只手正确地产生一个线程,我似乎无法正确的语法.这是我的代码......
// 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);
Run Code Online (Sandbox Code Playgroud)
功能定义
void spellCheck(vector<string> * fileRead, list<string> * incorrectWord, vector<string> * correctWord)
{
Run Code Online (Sandbox Code Playgroud)
头文件
void spellCheck(vector<string> *fileRead, list<string> *incorrectWord, vector<string> *correctWord);
Run Code Online (Sandbox Code Playgroud)
任何帮助将非常感激 :)
我的错误:
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*)'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
841 次 |
| 最近记录: |