Search Options

Results per page
Sort
Preferred Languages
Advance

Results 161 - 170 of 805 for goroutineID (0.39 sec)

  1. src/sync/waitgroup_test.go

    	for i := 0; i < 1000; i++ {
    		wg := &WaitGroup{}
    		n := new(int32)
    		// spawn goroutine 1
    		wg.Add(1)
    		go func() {
    			atomic.AddInt32(n, 1)
    			wg.Done()
    		}()
    		// spawn goroutine 2
    		wg.Add(1)
    		go func() {
    			atomic.AddInt32(n, 1)
    			wg.Done()
    		}()
    		// Wait for goroutine 1 and 2
    		wg.Wait()
    		if atomic.LoadInt32(n) != 2 {
    			t.Fatal("Spurious wakeup from Wait")
    		}
    	}
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 14 17:38:39 UTC 2021
    - 3K bytes
    - Viewed (0)
  2. src/cmd/cgo/internal/teststdio/testdata/fib.go

    // Copyright 2009 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    //go:build test_run
    
    // Compute Fibonacci numbers with two goroutines
    // that pass integers back and forth.  No actual
    // concurrency, just threads and synchronization
    // and foreign code on multiple pthreads.
    
    package main
    
    import (
    	"runtime"
    	"strconv"
    
    	"cgostdio/stdio"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 12 11:59:56 UTC 2023
    - 965 bytes
    - Viewed (0)
  3. src/internal/runtime/atomic/atomic_test.go

    		}
    	}
    
    	// Set every bit in array to 1.
    	a := make([]uint8, 1<<12)
    	for i := range a {
    		a[i] = 0xff
    	}
    
    	// Clear array bit-by-bit in different goroutines.
    	done := make(chan bool)
    	for i := 0; i < 8; i++ {
    		m := ^uint8(1 << i)
    		go func() {
    			for i := range a {
    				atomic.And8(&a[i], m)
    			}
    			done <- true
    		}()
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 25 19:53:03 UTC 2024
    - 8.5K bytes
    - Viewed (0)
  4. src/cmd/go/testdata/script/repro_build.txt

    # Check that goroutine scheduling does not affect compiler output.
    # If it does, reproducible builds will not work very well.
    [short] skip
    [GOOS:aix] env CGO_ENABLED=0  # go.dev/issue/56896
    env GOMAXPROCS=16
    go build -a -o http16.o net/http
    env GOMAXPROCS=17
    go build -a -o http17.o net/http
    cmp -q http16.o http17.o
    env GOMAXPROCS=18
    go build -a -o http18.o net/http
    cmp -q http16.o http18.o
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 13 18:59:19 UTC 2023
    - 686 bytes
    - Viewed (0)
  5. test/chan/sieve2.go

    		// In order to generate the nth prime we only need multiples of
    		// primes ≤ sqrt(nth prime).  Thus, the merging goroutine will
    		// receive from 'primes' much slower than this goroutine
    		// will send to it, making the buffer accumulate and block this
    		// goroutine from sending, causing a deadlock.  The solution is to
    		// use a proxy goroutine to do automatic buffering.
    		primes := sendproxy(primes)
    
    		candidates := odds()
    		p := <-candidates
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sun Feb 19 06:44:02 UTC 2012
    - 3.9K bytes
    - Viewed (0)
  6. staging/src/k8s.io/apiserver/pkg/storage/cacher/ready_test.go

    package cacher
    
    import (
    	"context"
    	"sync"
    	"testing"
    	"time"
    )
    
    func Test_newReady(t *testing.T) {
    	errCh := make(chan error, 10)
    	ready := newReady()
    	ready.set(false)
    	// create 10 goroutines waiting for ready
    	for i := 0; i < 10; i++ {
    		go func() {
    			errCh <- ready.wait(context.Background())
    		}()
    	}
    	select {
    	case <-time.After(1 * time.Second):
    	case <-errCh:
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Mar 16 13:32:11 UTC 2023
    - 4.6K bytes
    - Viewed (0)
  7. pkg/channels/unbounded_test.go

    )
    
    // wantReads contains the set of values expected to be read by the reader
    // goroutine in the tests.
    var wantReads []int
    
    func init() {
    	for i := 0; i < numWriters; i++ {
    		for j := 0; j < numWrites; j++ {
    			wantReads = append(wantReads, i)
    		}
    	}
    }
    
    // TestSingleWriter starts one reader and one writer goroutine and makes sure
    // that the reader gets all the value added to the buffer by the writer.
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed Aug 31 19:53:39 UTC 2022
    - 2.3K bytes
    - Viewed (0)
  8. src/syscall/syscall_linux_test.go

    			// question response sequence. This allows the
    			// test to race thread destruction too.
    			once := routines%5 == 4
    			go waiter(question, response, once)
    
    			// Keep a count of how many goroutines are
    			// going to participate in the
    			// question/response test. This will count up
    			// towards 2*launches minus the count of
    			// routines that have been invoked with
    			// once=true.
    			routines++
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 23K bytes
    - Viewed (0)
  9. src/internal/trace/testdata/generators/go122-syscall-steal-proc-gen-boundary.go

    }
    
    func gen(t *testgen.Trace) {
    	g := t.Generation(1)
    
    	// One goroutine is exiting with a syscall. It already
    	// acquired a new P.
    	b0 := g.Batch(trace.ThreadID(0), 0)
    	b0.Event("ProcStatus", trace.ProcID(1), go122.ProcRunning)
    	b0.Event("GoStatus", trace.GoID(1), trace.ThreadID(0), go122.GoSyscall)
    	b0.Event("GoSyscallEndBlocked")
    
    	// A running goroutine stole P0 at the generation boundary.
    	b1 := g.Batch(trace.ThreadID(1), 0)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 24 21:15:28 UTC 2024
    - 1.1K bytes
    - Viewed (0)
  10. src/runtime/testdata/testprogcgo/eintr.go

    	wg.Add(2)
    	go func() {
    		defer wg.Done()
    		defer w.Close()
    		// Spin before calling Write so that the first ReadFull
    		// in the other goroutine will likely be interrupted
    		// by a signal.
    		sendSomeSignals()
    		// This Write will likely be interrupted by a signal
    		// as the other goroutine spins in the middle of reading.
    		// We write enough data that we should always fill the
    		// pipe buffer and need multiple write system calls.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 05 17:54:15 UTC 2022
    - 5.2K bytes
    - Viewed (0)
Back to top