samedi 7 mars 2015

Go atomic and memory order

I am porting a lock free queue from c++11 to go and i came across things such as



auto currentRead = writeIndex.load(std::memory_order_relaxed);


and in some cases std::memory_order_release


is there an equivalent to such thing in go or do i just use something like



var currentRead uint64 = atomic.LoadUint64(&q.writeIndex)


after porting i benchmarked and just using LoadUint64 it seems to work as expected but orders of magnitude slower


Aucun commentaire:

Enregistrer un commentaire