[feature] add checking for pthread_spin_lock and use mutex instead of spinlock if POSIX not supported