ARM处理器的Store Buffer大小有限,内存屏障也无法保障可见性顺序
uint32_t Reflashflag = 0;
int32_t ErrorCnt = 0;
uint32_t PrintCont = 0;
pthread_mutex_t mutex; //增加mtx保护
int ready = 0; // 通过内置函数实现原子操作
// 定义读写锁
pthread_rwlock_t rwlock;
void Test1(void)
{
static uint32_t change = 0;
static uint32_t change1 = 0;
for(uint32_t cnt = 0 ; cnt < 5;cnt++)
{
change++;
change1++;
RTVolt1 = change;
RTVolt2 = change;
RTVolt3 = change;
RTVolt4 = change;
RTVolt5 = change;
RTVolt6 = change1;
RTVolt7 = change1;
RTVolt8 = change1;
RTVolt9 = change1;
RTVolt10 = change1;
RTVolt11 = change1;
RTVolt12 = change1;
RTVolt13 = change1;
}
__sync_synchronize();
//__atomic_s