Replaced mutex by spinlock in tests