Can I force cache coherency on a multicore x86 CPU?

后端 未结 9 1114
一个人的身影
一个人的身影 2020-11-29 18:43

The other week, I wrote a little thread class and a one-way message pipe to allow communication between threads (two pipes per thread, obviously, for bidirectional communica

9条回答
  •  庸人自扰
    2020-11-29 19:10

    You didn't specify which compiler you are using, but if you're on windows, take a look at this article here. Also take a look at the available synchronization functions here. You might want to note that in general volatile is not enough to do what you want it to do, but under VC 2005 and 2008, there are non-standard semantics added to it that add implied memory barriers around read and writes.

    If you want things to be portable, you're going to have a much harder road ahead of you.

提交回复
热议问题