updated version: replaced current mutex implementation with the one based on history list that keeps references to thread priorities, as well as original priority values