Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 1,309 for ATOMIC (0.1 sec)

  1. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/atomic/doc.go

    // Package atomic defines an Analyzer that checks for common mistakes
    // using the sync/atomic package.
    //
    // # Analyzer atomic
    //
    // atomic: check for common mistakes using the sync/atomic package
    //
    // The atomic checker looks for assignment statements of the form:
    //
    //	x = atomic.AddUint64(&x, 1)
    //
    // which are not atomic.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 09 01:28:01 UTC 2023
    - 505 bytes
    - Viewed (0)
  2. src/internal/runtime/atomic/bench_test.go

    	x = 1
    	ptr := &x
    	b.RunParallel(func(pb *testing.PB) {
    		for pb.Next() {
    			atomic.Cas(ptr, 1, 0)
    			atomic.Cas(ptr, 0, 1)
    		}
    	})
    }
    
    func BenchmarkCas64(b *testing.B) {
    	var x uint64
    	x = 1
    	ptr := &x
    	b.RunParallel(func(pb *testing.PB) {
    		for pb.Next() {
    			atomic.Cas64(ptr, 1, 0)
    			atomic.Cas64(ptr, 0, 1)
    		}
    	})
    }
    func BenchmarkXchg(b *testing.B) {
    	var x uint32
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 25 19:53:03 UTC 2024
    - 3.2K bytes
    - Viewed (0)
  3. src/runtime/race/race_linux_test.go

    	a := (*uint64)(unsafe.Pointer(&mem[0]))
    	if *a != 0 {
    		t.Fatalf("bad atomic value: %v, want 0", *a)
    	}
    	atomic.AddUint64(a, 1)
    	if *a != 1 {
    		t.Fatalf("bad atomic value: %v, want 1", *a)
    	}
    	atomic.AddUint64(a, 1)
    	if *a != 2 {
    		t.Fatalf("bad atomic value: %v, want 2", *a)
    	}
    }
    
    func TestAtomicPageBoundary(t *testing.T) {
    	// Test that atomic access near (but not cross) a page boundary
    	// doesn't fault. See issue 60825.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jun 16 14:09:02 UTC 2023
    - 1.9K bytes
    - Viewed (0)
  4. internal/rest/rpc-stats.go

    // GetRPCStats returns RPC stats, include calls errors and dhcp/tcp metrics
    func GetRPCStats() RPCStats {
    	s := RPCStats{
    		Errs:     atomic.LoadUint64(&globalStats.errs),
    		DialErrs: atomic.LoadUint64(&globalStats.tcpDialErrs),
    	}
    	if v := atomic.LoadUint64(&globalStats.tcpDialCount); v > 0 {
    		s.DialAvgDuration = atomic.LoadUint64(&globalStats.tcpDialTotalDur) / v
    	}
    	return s
    }
    
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Thu Sep 29 16:27:58 UTC 2022
    - 2.3K bytes
    - Viewed (0)
  5. src/runtime/lock_futex.go

    }
    
    func mutexContended(l *mutex) bool {
    	return atomic.Load(key32(&l.key)) > mutex_locked
    }
    
    func lock(l *mutex) {
    	lockWithRank(l, getLockRank(l))
    }
    
    func lock2(l *mutex) {
    	gp := getg()
    
    	if gp.m.locks < 0 {
    		throw("runtime·lock: lock count")
    	}
    	gp.m.locks++
    
    	// Speculative grab for lock.
    	v := atomic.Xchg(key32(&l.key), mutex_locked)
    	if v == mutex_unlocked {
    		return
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 17:57:34 UTC 2024
    - 5.4K bytes
    - Viewed (0)
  6. test/fixedbugs/issue19182.go

    package main
    
    import (
    	"fmt"
    	"runtime"
    	"sync/atomic"
    	"time"
    )
    
    var a uint64 = 0
    
    func main() {
    	runtime.GOMAXPROCS(2) // With just 1, infinite loop never yields
    
    	go func() {
    		for {
    			atomic.AddUint64(&a, uint64(1))
    		}
    	}()
    
    	time.Sleep(10 * time.Millisecond) // Short sleep is enough in passing case
    	i, val := 0, atomic.LoadUint64(&a)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 23:33:25 UTC 2023
    - 737 bytes
    - Viewed (0)
  7. src/cmd/go/testdata/script/cover_sync_atomic_import.txt

    go test -short -cover -covermode=atomic -coverpkg=coverdep/p1 coverdep
    
    # In addition to the above, test to make sure there is no funny
    # business if we try "go test -cover" in atomic mode targeting
    # sync/atomic itself (see #57445). Just a short test run is needed
    # since we're mainly interested in making sure the test builds and can
    # execute at least one test.
    
    go test -short -covermode=atomic -run=TestStoreInt64 sync/atomic
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 26 00:18:30 UTC 2024
    - 1011 bytes
    - Viewed (0)
  8. src/internal/runtime/atomic/atomic_test.go

    	p64 := (*int64)(u)   // misaligned
    
    	shouldPanic(t, "Load64", func() { atomic.Load64(up64) })
    	shouldPanic(t, "Loadint64", func() { atomic.Loadint64(p64) })
    	shouldPanic(t, "Store64", func() { atomic.Store64(up64, 0) })
    	shouldPanic(t, "Xadd64", func() { atomic.Xadd64(up64, 1) })
    	shouldPanic(t, "Xchg64", func() { atomic.Xchg64(up64, 1) })
    	shouldPanic(t, "Cas64", func() { atomic.Cas64(up64, 1, 2) })
    }
    
    func TestAnd8(t *testing.T) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 25 19:53:03 UTC 2024
    - 8.5K bytes
    - Viewed (0)
  9. internal/once/init.go

    func (l *Init) Do(f func() error) error {
    	if atomic.LoadUint32(&l.done) == 0 {
    		return l.do(f)
    	}
    	return nil
    }
    
    func (l *Init) do(f func() error) error {
    	l.m.Lock()
    	defer l.m.Unlock()
    	if atomic.LoadUint32(&l.done) == 0 {
    		if err := f(); err != nil {
    			return err
    		}
    		// Mark as done only when f() is successful
    		atomic.StoreUint32(&l.done, 1)
    	}
    	return nil
    }
    
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Tue May 09 04:20:31 UTC 2023
    - 2.1K bytes
    - Viewed (0)
  10. src/runtime/testdata/testprog/preempt.go

    	var ready, ready2 uint32
    	go func() {
    		for {
    			atomic.StoreUint32(&ready, 1)
    			dummy()
    			dummy()
    		}
    	}()
    	// Also start one with a frameless function.
    	// This is an especially interesting case for
    	// LR machines.
    	go func() {
    		atomic.AddUint32(&ready2, 1)
    		frameless()
    	}()
    	// Also test empty infinite loop.
    	go func() {
    		atomic.AddUint32(&ready2, 1)
    		for {
    		}
    	}()
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Dec 07 17:46:04 UTC 2021
    - 1.6K bytes
    - Viewed (0)
Back to top