if you stopping a thread and its using Thread::setPriority() inside -> deadlock. setCurrentThreadPriority works better (using it know)
solution:
something like
//pseude code
if (thread::getCurrentThreadId()==getThreadID())
{
thread::setCurrentThreadPriority
}
else
{
thread::setPriority()
}