Created
June 29, 2020 12:16
-
-
Save AbhinavPradeep/6bd2508e461946b0fedf7f493240a914 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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