4 ms·
And that's why I love Java. Somehow it's been there for almost 20 years.
by p2t2p 6y ago
And that's why I love Java. Somehow it's been there for almost 20 years.
- ncmncm 6y agoWhy I like Java, by Mark Dominus https://blog.plover.com/prog/Java.html https://blog.plover.com/prog/Java.html "I enjoyed programming in Java, and being relieved of the responsibility for producing a quality product."
- vips7L 6y ago(2014) Yeah java 6/7 was verbose, but it's nothing representative of the language now. You might as well point out the problems of C++03. Streams, lambdas, method references, records, and local variable inference make it pretty fluent to write and at the very least it has a sane standard library (I can't say as much for Scala). Also as for their intro problem what type of Java programmer worth their salt can't do: while (true) System.out.print(System.in.read());
- p2t2p 6y agoThis is something I always read from people who produce a puddle of noodle soup that keeps crunching through corner cases instead of producing something structured and actually readable by human beings.
- PaulDavisThe1st 6y agoGlib::Cond has existed for longer, and is just a wrapper around pthread condition variables that go back to the 1980s. Several other C++ libraries also provided condition variables, which latches are a variant of, along with barriers and flex_latches.
- Thorrez 6y agostd::condition_variable existed since c++11, so std::latch must provide some benefit beyond it.
- DSingularity 6y agoPerhaps differentiation is justified as program semantics can be captured to allow optimizations in runtimes. For example, condition variable to wait for events which can be delayed vs latched to wait for arrival of running threads to a point of execution. Runtime should handle each uniquely.
- PaulDavisThe1st 6y agoThe semantics of latch are a little simpler, which leaves room for a lighter weight implementation than is typically associated with condition variables. Barriers are closer, but also have slightly simpler semantics, again allowing for a potentially lighter weight implementation. But the semantics are not sufficiently different as to allow for any notably new use cases/code flow, certainly not from the examples I've seen. Every one of them could have been written using condition variables at any point in the last 30 years and would look almost indistinguishable.
- jillesvangurp 6y agoWorth noting Doug Lee's early work on adding concurrency to Java. That effort resulted in the java.util.concurrency package but work started in the late nineties and it was available as a separate library. And of course it included a Latch class; and the related CountDownLatch. http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/co... Before this stuff landed, Java's concurrency model was a lot less nice to deal with. Good high level abstractions are important. Nice to see the same kind of primitives are being added to C++.