Add mutexes into the drawing and updating logic so that calling setArray() during a draw can't cause a crash