Advanced Distributed Systems module at HSLU
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

27 lines
618 B

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace Sync_Ueb02_Latch
{
class Turf
{
static void Main()
{
ISynch startBox = new Latch();
for (int i = 1; i <= 5; i++)
{
new Thread(new RaceHorse(i, startBox).Run).Start();
}
// wait until all horses are ready
while(startBox.GetAmountOfAquires() < 5)
{
Thread.Sleep(20);
}
Console.WriteLine("Start...");
startBox.Release();
}
}
}