Monday 16 January 2017

What is Phasers in thread ?

Phasers
A phaser is a thread-synchronization construct that’s similar to a cyclic barrier in that it lets a group of threads wait on a barrier and then proceeds after the last thread arrives. It also offers the equivalent of a barrier action. However, a phaser is more flexible.

Unlike a cyclic barrier, which coordinates a fixed number of threads, a phaser can coordinate a variable number of threads, which can register at any timeTo implement this capability, a phaser takes advantage of phases and phase numbers. A phase is the phaser's current state, and this state is identified by an integer-based phase number. When the last of the registered threads arrives at the phaser barrier, a phaser advances to the next phase and increments its phase number by 1.

No comments:

Post a Comment