Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote