add spinlock to synchronize mdp