priority queue implemented (spin wait)