package main

import "unsafe"
import "sync/atomic"

type T struct {
    a *int // no ways?!
    b unsafe.Pointer
}

func (t T) A() *int {
    // cannot take the address of unsafe.Pointer(t.a)
    //return (*int)(atomic.LoadPointer(&unsafe.Pointer(t.a)))
    
    return t.a 
    // no ways to read t.a atomically if unsafe.Pointer and atomic.Value 
are not considered?
}

func (t T) B() unsafe.Pointer {
    return atomic.LoadPointer(&t.b)
}

func main() {
}

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to