Question

So i have a question about pthreads. The thing is i have 3 pites of threads lets call them T1, T2 and T3.

Then T1 locks the mutex, while is accessing the critical section, T2 and T3 arrive to the mutex and T2 has to take the mutex before T3 (always it has more priority).

How can i guarantee that this will always happen?

Was it helpful?

Solution

priority and mutex are independent concepts. For you case, you can set the priority of T2 to be higher than T3.

refer to pthread_setschedparam

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top