Friday, 8 April 2016

What are the usage of Latches ?


Latch can delay the progress of threads until it reaches its terminal state.
Once latch reaches the terminal state, the state cannot be changed.

Use of latch
  • to ensure that certain activities do not proceed until other activities complete

Use cases
  • to wait for all the players ready in a mutliplayer game
  • to ensure that a computation doesn't proceed until required resources have been initialized
  • to ensure that a service doesn't start until other services on which it depends have started


No comments:

Post a Comment

Note: only a member of this blog may post a comment.