Instantly share code, notes, and snippets.

Embed
What would you like to do?
class Program
{
    static void Main()
    {
        var quantidadeThreads = 100;

        for (int i = 0; i < quantidadeThreads; i++)
        {
            new Thread(new ThreadStart(() =>
            {
                //Infinitamente aberta, sempre sincronizando eventos...
                while (true)
                {
                    ObtemEventoDaFilaESincronizaComWebService();
                }
            })).Start();
        }

        Console.ReadLine();
    }

    private static void ObtemEventoDaFilaESincronizaComWebService()
    {
        Console.Write(".");
        Thread.Sleep(2000);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment