Skip to content

Instantly share code, notes, and snippets.

@AbhinavPradeep
Created June 29, 2020 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AbhinavPradeep/6bd2508e461946b0fedf7f493240a914 to your computer and use it in GitHub Desktop.
Save AbhinavPradeep/6bd2508e461946b0fedf7f493240a914 to your computer and use it in GitHub Desktop.
using System;
using System.Threading;
namespace MultiThreadedProgramming
{
class Program
{
static void Main(string[] args)
{
Account Savings = new Account();
Savings.Deposit(100.00);
Thread[] ArrayOfThreads = new Thread[15];
for (int i = 0; i < 15; i++)
{
Thread thread = new Thread(() =>
{
Savings.Withdraw(90.00);
});
ArrayOfThreads[i] = thread;
}
for (int i = 0; i < 15; i++)
{
ArrayOfThreads[i].Start();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment