PriorityLock

run the program by

g++ -pthread test.c -o test
./test

test

In the test file, we create 10 thread. And for each assign with a distinct priority level, ranging from 0 to 9.

By running the program, the result shows as below:

fig1: test result