This file contains hidden or 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
private static volatile int _theValue; |
This file contains hidden or 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
namespace manage_multithreading | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int theAlmightyZero = 0; | |
object _lockTheSavior = new object(); | |
Task newAmazingTask = Task.Run(() => |
This file contains hidden or 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
namespace manage_multithreading | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); | |
CancellationToken token = cancellationTokenSource.Token; | |
int theCount = 0; | |
Console.WriteLine("Task running...Count from 0 to..."); |
This file contains hidden or 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
namespace manage_multithreading | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); | |
CancellationToken token = cancellationTokenSource.Token; | |
int theCount = 0; | |
Console.WriteLine("Task running...Count from 0 to..."); |
This file contains hidden or 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
namespace manage_multithreading | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); | |
CancellationToken token = cancellationTokenSource.Token; | |
int theCount = 0; | |
Console.WriteLine("Task running...Count from 0 to..."); |
This file contains hidden or 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
namespace manage_multithreading | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Task notThatPowerfulTask = Task.Run(() => | |
{ | |
Console.WriteLine("A long-running task is being executed right now..."); | |
Thread.Sleep(10000); |
This file contains hidden or 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
namespace implement_program_flow | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var tasks = new[] {"Analyze", "Design", "Code", "Build", "Test", "Blue screen of death", "Deploy"}; | |
for (var i = 0; i < tasks.Length; i++) | |
{ | |
var task = tasks[i]; |
This file contains hidden or 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
namespace implement_program_flow | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var mainstreamCount = 0; | |
while (mainstreamCount > 0) | |
{ |
This file contains hidden or 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
namespace implement_program_flow | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var tasks = new[] { "Analyze", "Design", "Code", "Build", "Test", "Blue screen of death", "Deploy" }; | |
foreach (var task in tasks) | |
{ |
This file contains hidden or 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
namespace implement_program_flow | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var toJump = true; | |
if (toJump) |