[英]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.