Java blocking queues for concurrency beginners
geek-programmer.com
geek-programmer.com
In that context you have to use/implement Task rejection policies if queue is full. Blocking operation Put on the queue is not used when submitting task to the service, it uses Offer method instead. It's a bit misleading.
In Python they make it easier to right thread-safe code. I have written a similar article for Python with a focus on thread safety: https://lemanchet.fr/articles/learning-python-3-threading-mo...
To get the behavior of a select composed of several channels and no default case I'd have to dig into the exact behavior of the select statement in go, but it could be accomplished with a loop over if/else if/else statement where the else had a thread sleep/thread yield.
I actually wrote a dsl in Scala a few years back that actually used the keyword select for this operation before I'd ever encountered golang. I used "on" instead of case but the behaviors were nearly identical.
Hopefully something comes along to fill this gap officially. Channels are my favorite concurrency primitive by a huge margin. The more languages that support them, the better.
As the article points out, you can block the producers or consumers. So while queues and threading are advanced for an entirely new concurrency programmer, the are the most fundamental block of the concurrence developer.