set a critical section for when code is executing