partr: fix rare segfault (#32530)
The write to 'prio' might be arbitrarily delayed, after some other
thread has already popped the task. This commit ensures that all writes
to that field are always behind the same lock as the modification to the
queue itself.
fix #32520