- Sort Score
- Result 10 results
- Languages All
Results 1 - 3 of 3 for TryRead (0.41 sec)
-
internal/ringbuffer/ring_buffer_test.go
// ReadByte b, err := rb.ReadByte() if err != nil { readErr = err break } readBytes++ read.Write([]byte{b}) debugln("READ 2\t", 1, readBytes) // TryRead n, err = rb.TryRead(buf[:readRng.Intn(len(buf))]) readBytes += n read.Write(buf[:n]) debugln("READ 3\t", n, readBytes) if err != nil && err != ErrAcquireLock && err != ErrIsEmpty { readErr = err break
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Wed May 15 00:11:04 UTC 2024 - 26.8K bytes - Viewed (0) -
internal/ringbuffer/README.md
Regular Reads will block until data is available, but not wait for a full buffer. Writes will block until there is space available and writes bigger than the buffer will wait for reads to make space. `TryRead` and `TryWrite` are still available for non-blocking reads and writes. To signify the end of the stream, close the ring buffer from the writer side with `rb.CloseWriter()`
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Wed May 15 00:11:04 UTC 2024 - 2.1K bytes - Viewed (0) -
internal/ringbuffer/ring_buffer.go
} n, err = r.read(p) } if r.block && n > 0 { r.readCond.Broadcast() } return n, err } // TryRead read up to len(p) bytes into p like Read but it is not blocking. // If it has not succeeded to acquire the lock, it return 0 as n and ErrAcquireLock. func (r *RingBuffer) TryRead(p []byte) (n int, err error) { ok := r.mu.TryLock() if !ok { return 0, ErrAcquireLock } defer r.mu.Unlock()
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Wed May 15 00:11:04 UTC 2024 - 13.3K bytes - Viewed (0)