3 ms·
Forgive a bit of ignorance, it's been a bit since I've touched Go, but this looks awfully similar to a Java CountdownLatch [1]. Is this just a glorified Go por
by tombert 1y ago
Forgive a bit of ignorance, it's been a bit since I've touched Go, but this looks awfully similar to a Java CountdownLatch [1]. Is this just a glorified Go port of that or am I missing something vital here?
[1] https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CountDownLatch.html https://docs.oracle.com/javase/8/docs/api/java/util/concurre...
- xh-dude 1y agoPretty much. It’s a counting semaphore underneath.
- arccy 1y agoCountDownLatch looks like it can only count down? the go one you can add/remove at will
- layer8 1y agoPhaser [0] would be the more flexible equivalent in Java. [0] https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Phaser.html https://docs.oracle.com/javase/7/docs/api/java/util/concurre...
- tombert 1y agoYou are right; it looks like a Phaser is a bit more analogous: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Phaser.html https://docs.oracle.com/javase/8/docs/api/java/util/concurre...