-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Libc ringbuff implementation #23
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @octetd ! I had assumed you'd reuse the implementation from pipe.c, but I can dig wanting to reinvent that wheel :) Commented with a few issues I noted & other details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more comments. Those are the last stylistic changes I'll ask of you, promise ^^
For the _write
changes, I'm trying to make sure we have a rock solid data structure here. Avoiding new memory corruption issues is a big deal to me, as those are always very time consuming later on when they inevitably cause issues in unrelated parts of the project. As it is, it's hard to reason about, but I'm sure there's an issue with at least the updating of unread_data
.
Just one last thing: |
should be bounded now |
Would you mind cherry-picking the last commit from the
I did away with Merging right after that! |
I might take a little longer on my end today but should be done before long, thanks ^^
…-------- Original Message --------
On 24 Dec 2020, 09:00, Johan Manuel wrote:
Would you mind cherry-picking the last commit from the pr-ringbuffer branch, or making a commit with similar changes? Ring buffers are hard to get right, I tested thoroughly and found a few more issues:
- r_pos wasn't being updated when data was overwritten; it should always point to the oldest data
- unread_data was indeed bounded, but could now become smaller on writes ^^
I did away with w_pos, updating it independently from r_pos made things harder, since it's in fact entirely dependent on r_pos and unread_data.
Merging right after that!
—
You are receiving this because you were mentioned.
Reply to this email directly, [view it on GitHub](#23 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ABD5R2TQJ2WW5NGCZ3VJSRTSWMUPPANCNFSM4VF5B2LQ).
|
small update, had a few personal issues, will get it cherry picked tomorrow |
@29jm I did the cherry-pick as requested ^^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfection 👌
Thanks a lot! |
I'm opening this PR with the libc ring-buffer mentioned in #15, I intend to submit a later pr fixing #15 itself but for now to allow usage elsewhere I decided to open this PR now.
I did some heavy commenting on the code in the hopes that it can sort of explain itself.