Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for SwapPointer (0.16 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/doc.go

    // Consider using the more ergonomic and less error-prone [Uintptr.Swap] instead.
    func SwapUintptr(addr *uintptr, new uintptr) (old uintptr)
    
    // SwapPointer atomically stores new into *addr and returns the previous *addr value.
    // Consider using the more ergonomic and less error-prone [Pointer.Swap] instead.
    func SwapPointer(addr *unsafe.Pointer, new unsafe.Pointer) (old unsafe.Pointer)
    
    // CompareAndSwapInt32 executes the compare-and-swap operation for an int32 value.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jun 07 21:14:51 UTC 2024
    - 11.7K bytes
    - Viewed (0)
  4. 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)
  5. 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)
  6. src/sync/atomic/atomic_test.go

    		after  uintptr
    	}
    	var m uint64 = magic64
    	magicptr := uintptr(m)
    	x.before = magicptr
    	x.after = magicptr
    	var j unsafe.Pointer
    
    	for _, p := range testPointers() {
    		k := SwapPointer(&x.i, p)
    		if x.i != p || k != j {
    			t.Fatalf("p=%p i=%p j=%p k=%p", p, x.i, j, k)
    		}
    		j = p
    	}
    	if x.before != magicptr || x.after != magicptr {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 18:37:29 UTC 2024
    - 71.4K bytes
    - Viewed (0)
  7. src/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go

    		{"StorePointer", Func, 0},
    		{"StoreUint32", Func, 0},
    		{"StoreUint64", Func, 0},
    		{"StoreUintptr", Func, 0},
    		{"SwapInt32", Func, 2},
    		{"SwapInt64", Func, 2},
    		{"SwapPointer", Func, 2},
    		{"SwapUint32", Func, 2},
    		{"SwapUint64", Func, 2},
    		{"SwapUintptr", Func, 2},
    		{"Uint32", Type, 19},
    		{"Uint64", Type, 19},
    		{"Uintptr", Type, 19},
    		{"Value", Type, 4},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 534.2K bytes
    - Viewed (0)
  8. api/go1.2.txt

    pkg sort, func Stable(Interface)
    pkg strings, func IndexByte(string, uint8) int
    pkg sync/atomic, func SwapInt32(*int32, int32) int32
    pkg sync/atomic, func SwapInt64(*int64, int64) int64
    pkg sync/atomic, func SwapPointer(*unsafe.Pointer, unsafe.Pointer) unsafe.Pointer
    pkg sync/atomic, func SwapUint32(*uint32, uint32) uint32
    pkg sync/atomic, func SwapUint64(*uint64, uint64) uint64
    pkg sync/atomic, func SwapUintptr(*uintptr, uintptr) uintptr
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 18 04:36:59 UTC 2013
    - 1.9M bytes
    - Viewed (0)
Back to top