Question: The following code would not perform as expected due to the fact that each thread has its own dedicated stack, and is thus inaccessible to
The following code would not perform as expected due to the fact that each thread has its own dedicated stack, and is thus inaccessible to other threads. Assume threadfunc was just invoked as a result of a call to pthreadcreate
static struct data dataptr;
void threadfuncvoid arg
pthreadt workthr;
void workprod;
struct data indata struct data arg;
struct data mydata indata;
modify "mydata" here...
dataptr &mydata;
pthreadcreate&workthr, NULL, workthrfunc, NULL;
pthreadjoinworkthr &workprod;
process "workprod" here...
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
