optimizate the spinlock