Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for SwapPointer (0.13 sec)

  1. test/escape_sync_atomic.go

    }
    
    var ptr unsafe.Pointer
    
    func StorePointer() {
    	var x int // ERROR "moved to heap: x"
    	atomic.StorePointer(&ptr, unsafe.Pointer(&x))
    }
    
    func SwapPointer() {
    	var x int // ERROR "moved to heap: x"
    	atomic.SwapPointer(&ptr, unsafe.Pointer(&x))
    }
    
    func CompareAndSwapPointer() {
    	// BAD: x doesn't need to be heap allocated
    	var x int // ERROR "moved to heap: x"
    	var y int // ERROR "moved to heap: y"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 17 19:09:15 UTC 2019
    - 943 bytes
    - Viewed (0)
  2. src/runtime/atomic_pointer.go

    }
    
    //go:linkname sync_atomic_SwapUintptr sync/atomic.SwapUintptr
    func sync_atomic_SwapUintptr(ptr *uintptr, new uintptr) uintptr
    
    //go:linkname sync_atomic_SwapPointer sync/atomic.SwapPointer
    //go:nosplit
    func sync_atomic_SwapPointer(ptr *unsafe.Pointer, new unsafe.Pointer) unsafe.Pointer {
    	if writeBarrier.enabled {
    		atomicwb(ptr, new)
    	}
    	if goexperiment.CgoCheck2 {
    		cgoCheckPtrWrite(ptr, new)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 16:25:21 UTC 2024
    - 4K bytes
    - Viewed (0)
  3. src/sync/atomic/value.go

    		if typ != np.typ {
    			panic("sync/atomic: swap of inconsistently typed value into Value")
    		}
    		op := (*efaceWords)(unsafe.Pointer(&old))
    		op.typ, op.data = np.typ, SwapPointer(&vp.data, np.data)
    		return old
    	}
    }
    
    // CompareAndSwap executes the compare-and-swap operation for the [Value].
    //
    // All calls to CompareAndSwap for a given Value must use values of the same
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 26 20:48:55 UTC 2024
    - 5.9K bytes
    - Viewed (0)
  4. src/sync/atomic/type.go

    func (x *Pointer[T]) Store(val *T) { StorePointer(&x.v, unsafe.Pointer(val)) }
    
    // Swap atomically stores new into x and returns the previous value.
    func (x *Pointer[T]) Swap(new *T) (old *T) { return (*T)(SwapPointer(&x.v, unsafe.Pointer(new))) }
    
    // CompareAndSwap executes the compare-and-swap operation for x.
    func (x *Pointer[T]) CompareAndSwap(old, new *T) (swapped bool) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 18:37:29 UTC 2024
    - 8.5K bytes
    - Viewed (0)
Back to top