Replaced condition variable by spinlock, much faster when not contested