PolyWolf's Blog

wow another weekend project

Published: 3/10/2024, 10:15:22 AM

Originally published on Cohost.


Was talking with a friend, and he said something to the effect of “man, if only I had a lock-free ringbuffer right now…” I thought I had one of those lying around somewhere, but turns out I only sort of did:

So! To prove to myself that I can still write C code in a pinch, I decided to knock one out real fast. And I did! https://github.com/p0lyw0lf/silly_ringbuffer took a bit longer than expected (setting up C environment on Windows, solving some hard bugs like ABA), but overall I am very satisfied with the results.

Included Features

Missing Features

I might add these features sometime much later, but for now I consider it “good enough”; I have proven the point to myself, and my friend can continue with his own silly C project (he wanted a lock-free ringbuffer because “sharing a file across a fork()” isn’t cross-platform enough, doesn’t work on Windows).

Also, despite being a hackathon-like project, I always write my code with lots of documentation, so go read it!!! you might learn something or find another bug idk

#programming#c