Compiler reordering around mutex boundaries?

前端 未结 6 831
心在旅途
心在旅途 2020-12-17 23:14

Suppose I have my own non-inline functions LockMutex and UnlockMutex, which are using some proper mutex - such as boost - inside. How will the compiler know not to reorder o

6条回答
  •  臣服心动
    2020-12-17 23:23

    In general, a compiler will not move code around unless it knows with certainty that doing so will not affect run-time behavior.

提交回复
热议问题