日期:2014-05-16  浏览次数:20724 次

linux平台usleep(time);函数是否是原子操作不能被CPU线程切换打断?
linux平台usleep(time);函数是否是原子操作不能被CPU线程切换打断?

------解决方案--------------------
C/C++ code

ERRORS
       EINTR  Interrupted by a signal; see signal(7).

       EINVAL usec is not smaller than 1000000.  (On systems where that is considered an error.)

------解决方案--------------------
原子操作只能是以下情况

1. 指令本身是原子操作
2. 锁总线,例如lock前缀
3. 上其他锁