Replace mutex by spin lock