Queue thread safety

files under src/lib should not depend on src/switch and mutex routines are placed under src/switch.

This patch is puts mutex under src/switch side.