Ken Raeburn <[EMAIL PROTECTED]> writes: > Of course, the compiler might reorder these accesses, unless you > make everything volatile. Even then, the CPU still might reorder > them so another compiler might see something different. I'd be > worried about the reordering or caching in another processor if the > code decides it can bypass all the mutex stuff, too. > > Once every thread agrees on the new data value and no mutex needed, > everything should be fine, but managing the transition to that state > (without adding *another* mutex) is very tricky.
Yeah. I definitely wondered if there was a way to do it completely safely without full protection. I'm always hesitant about code that relies on so many assumptions, though I (obviously) wasn't thinking about the reordering issues. (Of course, I pretty much always fully protect things in real code, so it's not an issue...) > Actually, I think some memory models will allow some accesses to be > moved into the region where the lock is held from outside it. Interesting. Thanks -- Rob Browning rlb @defaultvalue.org and @debian.org; previously @cs.utexas.edu GPG starting 2002-11-03 = 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4 _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel