"Parties" as they relate to java's Phaser object

166 Views Asked by At

I am using a Phaser to attempt some synchronization in my java code. The documentation keeps mentioning registered/unregistered "parties"...

what is a "party" in this context? Does it refer to a single thread of execution? I keep going over the documentation from various sources, but they all assume knowledge of this. Is there some basic concurrency text I can read to get a better understanding of what is going on?

My understanding is that for every "register" that happens in the code, an corresponding "arriveAndDeregister" must occur, before the main thread can make it past the "arriveAndAwaitAdvance" line. Is this close to correct?

1

There are 1 best solutions below

0
Alejandro C. On

Yes, a "party" is just a thread that you're waiting for.

You do not need to deregister if you don't want to (you can call arrive() instead).