public static void Run()
    {
        Task[] tasks = new Task[TotalTaskCount];
        for (int i = 0; i < tasks.Length; ++i)
        {
            tasks[i] = Task.Factory.StartNew((param) =>
            {
                int index              = (int)param;
                int intTestValue       = index * 10;
                string stringTestValue = "ThreadStaticsTestWithTasks" + index;

                // Try to run the on every other task
                if ((index % 2) == 0)
                {
                    lock (lockObject)
                    {
                        SimpleReadWriteThreadStaticTest.Run(intTestValue, stringTestValue);
                    }
                }
                else
                {
                    SimpleReadWriteThreadStaticTest.Run(intTestValue, stringTestValue);
                }
            }, i);
        }
        for (int i = 0; i < tasks.Length; ++i)
        {
            tasks[i].Wait();
        }
    }
예제 #2
0
    static int Main()
    {
        SimpleReadWriteThreadStaticTest.Run(42, "SimpleReadWriteThreadStatic");
        ThreadStaticsTestWithTasks.Run();
        if (FinalizeTest.Run() != Pass)
        {
            return(Fail);
        }

        return(Pass);
    }
예제 #3
0
    static int Main()
    {
        SimpleReadWriteThreadStaticTest.Run(42, "SimpleReadWriteThreadStatic");

        // TODO: After issue https://github.com/dotnet/corert/issues/2695 is fixed, move FinalizeTest to run at the end
        if (FinalizeTest.Run() != Pass)
        {
            return(Fail);
        }

        ThreadStaticsTestWithTasks.Run();

        if (ThreadTest.Run() != Pass)
        {
            return(Fail);
        }

        return(Pass);
    }
예제 #4
0
 static int Main()
 {
     SimpleReadWriteThreadStaticTest.Run(42, "SimpleReadWriteThreadStatic");
     ThreadStaticsTestWithTasks.Run();
     return(100);
 }