added deadlock to the caman function