Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for WriteOnce (0.23 sec)

  1. staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/promise/promise.go

    package promise
    
    import (
    	"context"
    	"sync"
    )
    
    // promise implements the WriteOnce interface.
    type promise struct {
    	doneCtx context.Context
    	doneVal interface{}
    	setCh   chan struct{}
    	onceler sync.Once
    	value   interface{}
    }
    
    var _ WriteOnce = &promise{}
    
    // NewWriteOnce makes a new thread-safe WriteOnce.
    //
    // If `initial` is non-nil then that value is Set at creation time.
    //
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Aug 21 19:19:31 UTC 2023
    - 1.6K bytes
    - Viewed (0)
  2. src/net/write_unix_test.go

    		// Loop writing to the server. The server is not reading
    		// anything, so this will eventually block, and then time out.
    		b := bytes.Repeat([]byte{'a'}, 8192)
    		cagain := 0
    		for {
    			n, err := ss.conn.fd.pfd.WriteOnce(b)
    			if n > 0 {
    				cagain = 0
    			}
    			switch err {
    			case nil:
    			case syscall.EAGAIN:
    				if cagain == 0 {
    					// We've written enough data to
    					// start blocking. Set a deadline
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 28 18:17:57 UTC 2021
    - 1.6K bytes
    - Viewed (0)
  3. staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/testing/promise/counting.go

    	isSet         bool
    	value         interface{}
    }
    
    var _ promiseifc.WriteOnce = &countingPromise{}
    
    // NewCountingWriteOnce creates a WriteOnce that uses locking and counts goroutine activity.
    //
    // The final three arguments are like those for a regular WriteOnce factory:
    // - an optional initial value,
    // - an optional "done" channel,
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Aug 10 14:37:53 UTC 2021
    - 3.3K bytes
    - Viewed (0)
  4. staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/promise/interface.go

    See the License for the specific language governing permissions and
    limitations under the License.
    */
    
    package promise
    
    // WriteOnce represents a variable that is initially not set and can
    // be set once and is readable.  This is the common meaning for
    // "promise".
    type WriteOnce interface {
    	// Get reads the current value of this variable.  If this
    	// variable is not set yet then this call blocks until this
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Aug 10 14:37:53 UTC 2021
    - 1.2K bytes
    - Viewed (0)
  5. staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/promise/promise_test.go

    }
    
    func goGetExpectNotYet(t *testing.T, wr WriteOnce, gots chan interface{}, trigger string) {
    	go func() {
    		gots <- wr.Get()
    	}()
    	select {
    	case <-gots:
    		t.Errorf("Get returned before %s", trigger)
    	case <-time.After(time.Second):
    		t.Log("Good: Get did not return yet")
    	}
    }
    
    func goGetAndExpect(t *testing.T, wr WriteOnce, gots chan interface{}, expected interface{}) {
    	go func() {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Aug 21 19:19:31 UTC 2023
    - 3K bytes
    - Viewed (0)
  6. staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/testing/promise/counting_test.go

    	time.Sleep(time.Second) // give it a chance to misbehave
    	goGetAndExpect(t, clock, counter, wr, gots, aval)
    }
    
    func goGetExpectNotYet(t *testing.T, clk *testeventclock.Fake, grc counter.GoRoutineCounter, wr promise.WriteOnce, gots chan interface{}, trigger string) {
    	grc.Add(1) // count the following goroutine
    	go func() {
    		defer grc.Add(-1) // count completion of this goroutine
    		gots <- wr.Get()
    	}()
    	clk.Run(nil)
    	select {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Aug 10 14:37:53 UTC 2021
    - 4.6K bytes
    - Viewed (0)
  7. staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/queueset/types.go

    	// decisionCancel, or decisionExecute.
    	//
    	// decision.Set is called with the queueSet locked.
    	// decision.Get is called without the queueSet locked.
    	decision promise.WriteOnce
    
    	// arrivalTime is the real time when the request entered this system
    	arrivalTime time.Time
    
    	// descr1 and descr2 are not used in any logic but they appear in
    	// log messages
    	descr1, descr2 interface{}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Jul 18 17:38:43 UTC 2023
    - 6.9K bytes
    - Viewed (0)
  8. src/internal/poll/fd_unix.go

    // WaitWrite waits until data can be written to fd.
    func (fd *FD) WaitWrite() error {
    	return fd.pd.waitWrite(fd.isFile)
    }
    
    // WriteOnce is for testing only. It makes a single write call.
    func (fd *FD) WriteOnce(p []byte) (int, error) {
    	if err := fd.writeLock(); err != nil {
    		return 0, err
    	}
    	defer fd.writeUnlock()
    	return ignoringEINTRIO(syscall.Write, fd.Sysfd, p)
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 31 04:09:44 UTC 2024
    - 17.9K bytes
    - Viewed (0)
  9. staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/queueset/queueset.go

    	promiseFactoryFactory promiseFactoryFactory
    }
    
    // promiseFactory returns a WriteOnce
    // - whose Set method is invoked with the queueSet locked, and
    // - whose Get method is invoked with the queueSet not locked.
    // The parameters are the same as for `promise.NewWriteOnce`.
    type promiseFactory func(initial interface{}, doneCtx context.Context, doneVal interface{}) promise.WriteOnce
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Jan 04 16:59:21 UTC 2024
    - 42.4K bytes
    - Viewed (0)
  10. staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/queueset/queueset_test.go

    func countingPromiseFactoryFactory(activeCounter counter.GoRoutineCounter) promiseFactoryFactory {
    	return func(qs *queueSet) promiseFactory {
    		return func(initial interface{}, doneCtx context.Context, doneVal interface{}) promise.WriteOnce {
    			return testpromise.NewCountingWriteOnce(activeCounter, &qs.lock, initial, doneCtx.Done(), doneVal)
    		}
    	}
    }
    
    func TestTotalRequestsExecutingWithPanic(t *testing.T) {
    	metrics.Register()
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Sep 26 12:55:23 UTC 2023
    - 58.4K bytes
    - Viewed (0)
Back to top