Analogue of priority queue

Nice solution!! but i have one question is this thread safe for a scenario of one consumer and many producers?