In c++, I\'m asked to write a function whose argument and return value are both
ID: 3568716 • Letter: I
Question
In c++, I'm asked to write a function whose argument and return value are both of type void * . Supposedly, this means that the function can take and return pointers to anything. In addition, I'm trying to create a structure that can hold all of the information that the thread will need to execute, and create an instance of this structure contaning the information for this thread.
I know that I'll start the thread by using this:
pthread_create(&mThread, NULL, &mFunction, &mArgs);
Here, "mThread" is the thread variable, previously declared in my program. mFunction is the name of the function listed above, and mArgs is the structure listed above. I'll also wait for the thread to complete using this function call:
pthread_join(mThread, NULL)
I'm a bit confused. Can you help?
Explanation / Answer
pthread_create(&mThread, NULL, &mFunction, &mArgs);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.