-
I needed a concurrent queue that would block when attempting to pop an empty queue, which allows the consuming thread to suspend while it's waiting for work. I found that using mutexes allowed me to develop a simple template adapter had several advantages with few drawbacks when compared to non-blocking queues: it can use a variety of containers, the code can be reviewed and verified as to its correctness (very hard to do with fancy concurrent programming that avoids mutexes), and it is only slightly slower than fancier solutions (when I benchmarked it originally, it was 4x slower than Moody Camel's concurrent queue, which to me is fine performance).
-
JetBrains
Tell us how you use coding tools. You may win a prize! Are you a developer or a data analyst? Share your thoughts about your coding tools in our short survey and get a chance to win prizes!
Related posts
-
Concurrency kills ordering. But there's a fix (3 Go patterns compared)
-
Scar - A programming language for easy concurrency and parallelism
-
Show HN: Sidequest.js – Background jobs for Node.js using your database
-
Async Ruby is the Future of AI Apps (And It's Already Here)
-
Abstraction boundaries are optimization boundaries