楼主:
shihyuyao (shihyuyao)
2016-05-12 00:07:39https://gist.github.com/shihyu/813d13cc5803d259f74d29870f32f0ab
我起两个 thread 测试交错打印
pthread_mutex_unlock 之后过故意sleep(1) 让另一条thread 可以先lock
这样应该是
ap1_thread[+]
ap2_thread[-]
ap1_thread[+]
ap2_thread[-]
不断交错
, 可是我测试结果会出现有连续印两个ap2_thread[-]
ap1_thread[+]
ap2_thread[-]
ap1_thread[+]
ap2_thread[-]
ap2_thread[-]
ap1_thread[+]
ap2_thread[-]
ap1_thread[+]
请问这是可能是什么原因造成
谢谢