Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 121 for addUint32 (0.22 sec)

  1. src/cmd/go/internal/par/work_test.go

    package par
    
    import (
    	"sync/atomic"
    	"testing"
    	"time"
    )
    
    func TestWork(t *testing.T) {
    	var w Work[int]
    
    	const N = 10000
    	n := int32(0)
    	w.Add(N)
    	w.Do(100, func(i int) {
    		atomic.AddInt32(&n, 1)
    		if i >= 2 {
    			w.Add(i - 1)
    			w.Add(i - 2)
    		}
    		w.Add(i >> 1)
    		w.Add((i >> 1) ^ 1)
    	})
    	if n != N+1 {
    		t.Fatalf("ran %d items, expected %d", n, N+1)
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 03 09:56:24 UTC 2023
    - 1.5K bytes
    - Viewed (0)
  2. internal/lsync/lrwmutex_test.go

    	for i := 0; i < numIterations; i++ {
    		if rwm.GetRLock(context.Background(), "", "", time.Second) {
    			n := atomic.AddInt32(activity, 1)
    			if n < 1 || n >= 10000 {
    				panic(fmt.Sprintf("wlock(%d)\n", n))
    			}
    			for i := 0; i < 100; i++ {
    			}
    			atomic.AddInt32(activity, -1)
    			rwm.RUnlock()
    		}
    	}
    	cdone <- true
    }
    
    // Borrowed from rwmutex_test.go
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Sun Mar 05 04:57:35 UTC 2023
    - 7.9K bytes
    - Viewed (0)
  3. src/runtime/race/testdata/atomic_test.go

    	go func() {
    		x1 = 1
    		if atomic.AddInt32(&s, 1) == 2 {
    			x2 = 1
    		}
    		ch <- true
    	}()
    	go func() {
    		x2 = 1
    		if atomic.AddInt32(&s, 1) == 2 {
    			x1 = 1
    		}
    		ch <- true
    	}()
    	<-ch
    	<-ch
    }
    
    func TestNoRaceAtomicLoadAddInt32(t *testing.T) {
    	var x int64
    	_ = x
    	var s int32
    	go func() {
    		x = 2
    		atomic.AddInt32(&s, 1)
    	}()
    	for atomic.LoadInt32(&s) != 1 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Nov 16 17:26:46 UTC 2020
    - 4.9K bytes
    - Viewed (0)
  4. pkg/controller/tainteviction/timed_workers_test.go

    )
    
    func TestExecute(t *testing.T) {
    	testVal := int32(0)
    	wg := sync.WaitGroup{}
    	wg.Add(5)
    	queue := CreateWorkerQueue(func(ctx context.Context, fireAt time.Time, args *WorkArgs) error {
    		atomic.AddInt32(&testVal, 1)
    		wg.Done()
    		return nil
    	})
    	now := time.Now()
    	queue.AddWork(context.TODO(), NewWorkArgs("1", "1"), now, now)
    	queue.AddWork(context.TODO(), NewWorkArgs("2", "2"), now, now)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Oct 30 12:23:56 UTC 2023
    - 5.6K bytes
    - Viewed (0)
  5. test/codegen/atomics.go

    	// (for arm64HasATOMICS), while ARM64 v8.1 has only atomic and no dynamic check.
    	// arm64/v8.0:"LDADDALW"
    	// arm64/v8.1:"LDADDALW"
    	// arm64/v8.0:".*arm64HasATOMICS"
    	// arm64/v8.1:-".*arm64HasATOMICS"
    	atomic.AddInt32(&c.count, 1)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 21 20:08:06 UTC 2024
    - 728 bytes
    - Viewed (0)
  6. src/sync/rwmutex_test.go

    	for i := 0; i < num_iterations; i++ {
    		rwm.RLock()
    		n := atomic.AddInt32(activity, 1)
    		if n < 1 || n >= 10000 {
    			rwm.RUnlock()
    			panic(fmt.Sprintf("wlock(%d)\n", n))
    		}
    		for i := 0; i < 100; i++ {
    		}
    		atomic.AddInt32(activity, -1)
    		rwm.RUnlock()
    	}
    	cdone <- true
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 29 17:13:13 UTC 2021
    - 4.9K bytes
    - Viewed (0)
  7. test/fixedbugs/issue16948.go

    // confuse the scheduler.
    
    package main
    
    import "sync/atomic"
    
    func main() {
    	f()
    }
    
    var x int32
    
    type T [10]int
    var sink *T
    
    func f() (t T) {
    	atomic.AddInt32(&x, 1)
    	g(42, 42, 42, 42, 42, &t) // use int values that is invalid pointer to smash the stack slot of return value of runtime.newobject
    	return
    }
    
    //go:noinline
    func g(a, b, c, d, e int, p *T) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Sep 01 14:25:46 UTC 2016
    - 703 bytes
    - Viewed (0)
  8. staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testing/authentication_info_resolver.go

    }
    
    func (a *authenticationInfoResolver) ClientConfigFor(hostPort string) (*rest.Config, error) {
    	atomic.AddInt32(a.cacheMisses, 1)
    	return a.restConfig, nil
    }
    
    func (a *authenticationInfoResolver) ClientConfigForService(serviceName, serviceNamespace string, servicePort int) (*rest.Config, error) {
    	atomic.AddInt32(a.cacheMisses, 1)
    	return a.restConfig, nil
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 18 18:49:55 UTC 2022
    - 2.7K bytes
    - Viewed (0)
  9. src/cmd/internal/bio/buf_mmap.go

    	// mapping, especially since we have no way to unmap it.
    	const threshold = 16 << 10
    	if length < threshold {
    		return nil, false
    	}
    
    	// Have we reached the mmap limit?
    	if atomic.AddInt32(&mmapLimit, -1) < 0 {
    		atomic.AddInt32(&mmapLimit, 1)
    		return nil, false
    	}
    
    	// Page-align the offset.
    	off := r.Offset()
    	align := syscall.Getpagesize()
    	aoff := off &^ int64(align-1)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 19 11:20:31 UTC 2024
    - 1.6K bytes
    - Viewed (0)
  10. test/fixedbugs/issue20335.go

    // without the fix in the CL that added this file.
    // TODO: check the generated assembly?
    
    package a
    
    import "sync/atomic"
    
    func f(p, q *int32) bool {
    	x := *q
    	return atomic.AddInt32(p, 1) == x
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 11 22:16:08 UTC 2017
    - 467 bytes
    - Viewed (0)
Back to top