Abstract
- Synchronising Thread while they are running concurrently. So that they all reach the same point before any of them proceed
- Used when we need information from multiple Thread at a particular execution point. For example Roll Dice
- Need to compile with
-pthread
flag
Code Snippet
Example
Roll Dice
- Each Thread rolls a dice, the main thread decides who is the winner. Then each thread shouts if it is a winner or not
- Sample Code