예제 #1
0
    public void Execute()
    {
        var sw = ProcessStopwatch.Start();

        Task.WaitAll(_tasks.ToArray());

        sw.Stop();

        Elapsed = sw.Elapsed;

        ConsoleOutput.Write(GetType(), message: $"All tasks completed...");
    }
    public void Execute()
    {
        var sw = ProcessStopwatch.Start();

        var threads = new Thread[_groupWriteModels.Count()];

        for (var i = 0; i < _groupWriteModels.Count(); i++)
        {
            threads[i]          = new Thread(new ParameterizedThreadStart(ExecuteInternal));
            threads[i].Priority = ThreadPriority.Normal;

            threads[i].Start(_groupWriteModels[i]);
        }

        for (var i = 0; i < _groupWriteModels.Count(); i++)
        {
            threads[i].Join();
        }

        sw.Stop();
        Elapsed = sw.Elapsed;

        ConsoleOutput.Write(GetType(), message: $"All threads completed...");
    }