Hi,
I am using beagle Bone Black with debian image. Could any please suggest
how to optimize the application code using pthread_mutex_lock. Let me
describe the solution I am looking at.
For example, I have two thread sharing a global shared memory variable as
below
thr_id1 = pthread_create ( &p_thread1, NULL, (void *)execution_task1, NULL
);
thr_id2 = pthread_create ( &p_thread2, NULL, (void *)execution_task2, NULL
);
void execution_task1()
{
for(int i = 0;i < 100;i++)
{
pthread_mutex_lock(&lock);
shmPtr->status = 1;
pthread_mutex_unlock(&lock);
sleep(1/2);
}
}
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beagleboard/fe4074cd-ff97-4e7c-8d68-02ba9a0d5678n%40googlegroups.com.