线程同步机制之自旋锁
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <pthread.h>#include <errno.h>/* 定义变量 */pthread_spinlock_t spin;/*定义全局变量*/int i = 0