Unbuffered Channels implementation

I’ve created a simple unbuffered channels implementation to try to learn Zig and get to know some of the concepts. So far I’ve really enjoyed the language and find a lot of the concepts like compile time code and error unions to be very intuitive.

I would love any suggestions or comments on my implementation. I feel there is still chance for deadlock in my example program (if I remove the call to std.time.tickMilliseconds it will lock up) and I’m not exactly sure why. I’m not sure if this is due to my example program or my channels implementation.

Check out the example program here: GitHub - negcx/zfreq
The channels implementation is here: zfreq/chan.zig at master · negcx/zfreq · GitHub

Thanks to some help on Discord I’ve fixed the locks so it should be pretty safe now.

1 Like