The atomic functions force a memory barrier when atomically in conjunction with 
the atomic read of the same value. 

You could use CGO to call a C function to do what you desire - but it shouldn’t 
be necessary. 

Not sure what else I can tell you. 

> On Jan 22, 2023, at 8:12 PM, Peter Rabbitson <ribasu...@gmail.com> wrote:
> 
> 
>> On Mon, Jan 23, 2023 at 12:42 AM robert engels <reng...@ix.netcom.com> wrote:
> 
>> Write data to memory mapped file/shared memory. Keep track of last written 
>> byte as new_length;
>> 
>> Use atomic.StoreUint64(pointer to header.length, new_length);
>> 
> 
> This does not answer the question I posed, which boils down to:
> 
> How does one insert the equivalent of smp_wmb() / asm volatile("" ::: 
> "memory") into a go program.
> 
> For instance is any of these an answer? 
> https://groups.google.com/g/golang-nuts/c/tnr0T_7tyDk/m/9T2BOvCkAQAJ
>  
>> readers read ...
> 
> Please don't focus on the reader ;) 
>  
>> This assumes you are always appending ,,, then it is much more complicated 
>> ... all readers have consumed the data before the writer reuses it.
> 
> Yes, it is much more complicated :) I am making a note to post the result 
> back to this thread in a few weeks when it is readable enough.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/5F73A3C7-32C3-42A1-91A2-E1A0714FAEA5%40ix.netcom.com.

Reply via email to