Skip to content

Instantly share code, notes, and snippets.

@fabriciorissetto
Last active February 5, 2017 21:33
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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