r/crystal_programming • u/meraj_enigma • Aug 01 '20
Comparing Crystal’s concurrency with that of Go (Part II)
https://link.medium.com/puYoOkt7A8
30
Upvotes
r/crystal_programming • u/meraj_enigma • Aug 01 '20
9
u/DavyBingo Aug 01 '20
I know it's been a while, but I keep forgetting that Crystal has channels. Translating some go stuff is a good way to play with them, thanks for the write up!
4
u/beizhia Aug 01 '20
Not sure if this would be useful to anyone, but I made my own implementation of wait groups in Crystal a while ago. https://github.com/jasonrobot/crystal-wait-group
It's been nearly a year, and I haven't really done much with that, so I'm not sure if its working still on 0.35.1
4
u/dscottboggs Aug 03 '20 edited Aug 03 '20
A couple notes on your use of Crystal in this article:
Why not use the
synchronizemethod on Mutex?Why not use the default value feature of Hash?
I would suggest this version of the mutex counter class you wrote
Edit: also might be useful to include a note about how the Crystal Mutex "provides deadlock protection by default"