Question: Before entering a priority critical section, a thread calls PriorityLock::enter(priority) and when the thread exits such a critical section it calls PriorityLock::exit(). If several threads are waiting to enter a priority critical section the one with the numerically highest priority should be the next one allowed in. Implement PriorityLock using monitors (locks and condition variables) and following the multi-threaded programming standards defined for the class.
(a) Define the state and synchronization variables and describe the purpose of each.
(b) Implement PriorityLock::enter(int priority)
(c) Implement PriorityLock::exit()