Adding critical section

Adding section in run method that accesses shared data location.