Hello i need a hand on spawning a thread properly, i cant seem to get the syntax correct.
here is my code …
// 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);
function definition
void spellCheck(vector<string> * fileRead, list<string> * incorrectWord, vector<string> * correctWord)
{
header file
void spellCheck(vector<string> *fileRead, list<string> *incorrectWord, vector<string> *correctWord);
Any help would be much appreciated 🙂
my error:
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*)'
I may be wrong here but I thought that the thread function you implement and pass to pthread_create() could only have a single (void*) input argument