use spin lock instead of pthread mutex lock