Check out example codes for "countdownevent". It will help you in understanding the concepts better.

Code Example 1

class Program
{
    static void Main(string[] args)
    {
        CountdownEvent countObject = new CountdownEvent(10);
        int[] result = new int[10];
 
 
        for (int i = 0; i < 10; ++i)
        {
            int j = i;
            Task.Factory.StartNew(() =>
                {
 
                    Thread.Sleep(TimeSpan.FromSeconds(3));
                    result[j] = j * 10;
 
                    countObject.Signal();
                });
        }
 
        countObject.Wait();
 
        foreach (var r in result)
        {
            Console.WriteLine(r);
        }
             
        Console.ReadLine();
 
        /* Result
            * 0
            * 10
            * 20
            * 30
            * 40
            * 50
            * 60
            * 70
            * 80
            * 90 */
 
    }
}

Learn ReactJs, React Native from akashmittal.com