Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 2,669 for done2 (0.1 sec)

  1. internal/once/init.go

    	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
    }
    
    // DoWithContext is similar to Do except that it accepts a context as an argument to be passed.
    func (l *Init) DoWithContext(ctx context.Context, f func(context.Context) error) error {
    	if atomic.LoadUint32(&l.done) == 0 {
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Tue May 09 04:20:31 UTC 2023
    - 2.1K bytes
    - Viewed (0)
  2. src/net/rpc/client.go

    	if done == nil {
    		done = make(chan *Call, 10) // buffered.
    	} else {
    		// If caller passes done != nil, it must arrange that
    		// done has enough buffer for the number of simultaneous
    		// RPCs that will be using that channel. If the channel
    		// is totally unbuffered, it's best not to run at all.
    		if cap(done) == 0 {
    			log.Panic("rpc: done channel is unbuffered")
    		}
    	}
    	call.Done = done
    	client.send(call)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jan 10 03:29:50 UTC 2024
    - 9K bytes
    - Viewed (0)
  3. src/cmd/vendor/golang.org/x/sync/semaphore/semaphore.go

    // are available or ctx is done. On success, returns nil. On failure, returns
    // ctx.Err() and leaves the semaphore unchanged.
    func (s *Weighted) Acquire(ctx context.Context, n int64) error {
    	done := ctx.Done()
    
    	s.mu.Lock()
    	select {
    	case <-done:
    		// ctx becoming done has "happened before" acquiring the semaphore,
    		// whether it became done before the call began or while we were
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 03 02:38:00 UTC 2024
    - 4.3K bytes
    - Viewed (0)
  4. test/fixedbugs/issue57823.go

    	str("AAAAAAAA", "BBBBBBBBB")
    }
    
    func wait(done <-chan struct{}) bool {
    	for i := 0; i < 10; i++ {
    		runtime.GC()
    		select {
    		case <-done:
    			return true
    		default:
    		}
    	}
    	return false
    }
    
    func slice() {
    	s := make([]byte, 100)
    	s[0] = 1
    	one := unsafe.SliceData(s)
    
    	done := make(chan struct{})
    	runtime.SetFinalizer(one, func(*byte) { close(done) })
    
    	h := g(one)
    
    	if wait(done) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jan 18 01:27:21 UTC 2023
    - 1.1K bytes
    - Viewed (0)
  5. src/context/context.go

    	// The close of the Done channel may happen asynchronously,
    	// after the cancel function returns.
    	//
    	// WithCancel arranges for Done to be closed when cancel is called;
    	// WithDeadline arranges for Done to be closed when the deadline
    	// expires; WithTimeout arranges for Done to be closed when the timeout
    	// elapses.
    	//
    	// Done is provided for use in select statements:
    	//
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 26 19:58:28 UTC 2024
    - 23.7K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/test/testdata/slice_test.go

    	s []int
    }
    
    func TestSlice(t *testing.T) {
    	done := make(chan struct{})
    	a := make([]int, N+10)
    
    	x := &X{a}
    
    	go func() {
    		for i := 0; i < N; i++ {
    			x.s = x.s[1:9]
    		}
    		done <- struct{}{}
    	}()
    	go func() {
    		for i := 0; i < N; i++ {
    			x.s = x.s[0:8] // should only write len
    		}
    		done <- struct{}{}
    	}()
    	<-done
    	<-done
    
    	if cap(x.s) != cap(a)-N {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Dec 23 06:40:04 UTC 2020
    - 850 bytes
    - Viewed (0)
  7. src/sync/once.go

    	// This is why the slow path falls back to a mutex, and why
    	// the o.done.Store must be delayed until after f returns.
    
    	if o.done.Load() == 0 {
    		// Outlined slow-path to allow inlining of the fast-path.
    		o.doSlow(f)
    	}
    }
    
    func (o *Once) doSlow(f func()) {
    	o.m.Lock()
    	defer o.m.Unlock()
    	if o.done.Load() == 0 {
    		defer o.done.Store(1)
    		f()
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jun 07 21:14:51 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  8. staging/src/k8s.io/apimachinery/pkg/util/waitgroup/ratelimited_waitgroup_test.go

    	// are finished using the waitgroup
    	n2DoneWG := sync.WaitGroup{}
    
    	startCh, blockedCh := make(chan struct{}), make(chan struct{})
    	n1DoneWG.Add(n1)
    	for i := 0; i < n1; i++ {
    		go func() {
    			defer n1DoneWG.Done()
    			<-startCh
    
    			target.Add(1)
    			// let's finish using the waitgroup immediately
    			target.Done()
    		}()
    	}
    
    	n2BeforeWaitWG.Add(n2)
    	n2DoneWG.Add(n2)
    	for i := 0; i < n2; i++ {
    		go func() {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Feb 21 14:08:00 UTC 2023
    - 8.6K bytes
    - Viewed (0)
  9. src/runtime/race/testdata/mop_test.go

    		for {
    			_, ok := <-c
    			if !ok {
    				done <- true
    				return
    			}
    			x++
    		}
    	}()
    	for i := 0; i < 10; x++ {
    		i++
    		c <- true
    	}
    	close(c)
    	<-done
    }
    
    func TestNoRaceForIncr(t *testing.T) {
    	done := make(chan bool)
    	x := 0
    	go func() {
    		x++
    		done <- true
    	}()
    	for i := 0; i < 0; x++ {
    	}
    	<-done
    }
    
    func TestRacePlus(t *testing.T) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jun 23 16:46:25 UTC 2023
    - 28.9K bytes
    - Viewed (0)
  10. internal/grid/stream.go

    			}
    			err = next(resp.Msg)
    			if err != nil {
    				s.cancel(err)
    				return err
    			}
    		}
    	}
    }
    
    // Done will return a channel that will be closed when the stream is done.
    // This mirrors context.Done().
    func (s *Stream) Done() <-chan struct{} {
    	return s.ctx.Done()
    }
    
    // Err will return the error that caused the stream to end.
    // This mirrors context.Err().
    func (s *Stream) Err() error {
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Fri Jun 07 15:51:52 UTC 2024
    - 3.1K bytes
    - Viewed (0)
Back to top