andrewrk / andrewrk/libsoundio

ring_buffer asserts on overflow

オープン
#159 コメント 1 件 リアクション 2 件 担当者 0 名 GitHub で見る
主要言語
C
スター
2.1k
フォーク
254
PR マージ指標
30日以内にマージされた PR はありません

説明

```
int soundio_ring_buffer_fill_count(struct SoundIoRingBuffer *rb) {
// Whichever offset we load first might have a smaller value. So we load
// the read_offset first.
long read_offset = SOUNDIO_ATOMIC_LOAD(rb->read_offset);
long write_offset = SOUNDIO_ATOMIC_LOAD(rb->write_offset);
int count = write_offset - read_offset;
assert(count >= 0);
assert(count <= rb->capacity);
return count;
}
```

I guess that is by design but it is definitely not the expected behaviour. I would either expect the read pointer to follow the write pointer when it was full. This would require the ring buffer to know its element size which is probably a good idea anyway.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。