예제 #1
0
    public static void Main()
    {
        Console.Title = "Semaphore Test";

        STT = new SemaphoreTestAgent();
        PT  = new ProgramTools();

        for (int i = 0; i < 10; i++)
        {
            Thread thread = new Thread(AcquireToken);
            thread.Name         = String.Format("{0}", i + 1);
            thread.IsBackground = true;
            thread.Start();
            STT.ThreadAcquisitionMap.Add(thread, new ThreadData());
        }

        PT.Start();
        STT.Start(ReleaseToken);
    }