Hello everyone,
welcome back to can you spot the deadlock take 4. As a reminder, this a puzzle in a form of multithreaded code. You have to identify the issue that hides in it, usually a deadlock, but not always. Please post your answer in the comments section.
Since it has been a long time since the last episode, let’s start easy!
So what is the problem with this code and how would you fix it?
class Program
{
static void Main(string[] args)
{
var workerThread = new Thread(Worker);
workerThread.Start();
workerThread.Join();
}
static void Worker()
{
while (Thread.CurrentThread.IsAlive)
{
Console.Write("Blah ");
}
}
}