Remix.run Logo
tombert 2 days 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/concurre...

arccy 2 days ago | parent | next [-]

CountDownLatch looks like it can only count down? the go one you can add/remove at will

layer8 2 days ago | parent | next [-]

Phaser [0] would be the more flexible equivalent in Java.

[0] https://docs.oracle.com/javase/7/docs/api/java/util/concurre...

tombert 2 days ago | parent | prev [-]

You are right; it looks like a Phaser is a bit more analogous: https://docs.oracle.com/javase/8/docs/api/java/util/concurre...

xh-dude 2 days ago | parent | prev [-]

Pretty much. It’s a counting semaphore underneath.