In reply to dave_59:
for example , i have queue in my code. And I have two class A and B.
there is functionA in classA which put some data to the queue. Another function B is to clean
the queue data. Two functions running paraelly, I worry that when function A is putting some data and functionA is cleaning queue at the same time. therefore i want to ensure function B should clear the queue only for no one accessing this queue.