Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for TryWriteByte (0.16 sec)

  1. internal/ringbuffer/ring_buffer_test.go

    				t.Fatalf("write failed: %v", err)
    			}
    			wroteBytes += n
    			wrote.Write(buf[:n])
    			debugln("WRITE 4\t", n, wroteBytes)
    
    			// TryWriteByte
    			err = rb.TryWriteByte(buf[0])
    			if err != nil && err != ErrAcquireLock && err != ErrTooMuchDataToWrite && err != ErrIsFull {
    				t.Fatalf("write failed: %v", err)
    			}
    			if err == nil {
    				wroteBytes++
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Wed May 15 00:11:04 UTC 2024
    - 26.8K bytes
    - Viewed (0)
  2. internal/ringbuffer/ring_buffer.go

    		err = r.setErr(r.writeByte(c), true)
    	}
    	if r.block && err == nil {
    		r.writeCond.Broadcast()
    	}
    	return err
    }
    
    // TryWriteByte writes one byte into buffer without blocking.
    // If it has not succeeded to acquire the lock, it return ErrAcquireLock.
    func (r *RingBuffer) TryWriteByte(c byte) error {
    	ok := r.mu.TryLock()
    	if !ok {
    		return ErrAcquireLock
    	}
    	defer r.mu.Unlock()
    	if err := r.err; err != nil {
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Wed May 15 00:11:04 UTC 2024
    - 13.3K bytes
    - Viewed (0)
Back to top