Geeks With Blogs

Geekus Con Livus Malcolm Anderson's home for Geeks With Lives

According to the Apress Support page, there is no Errata for the C# Threading Handbook.


This is too bad because that means that there is no central repository for errata, code listings and other stuff for this really great book.


Here is the first real bug I've found in this book.


On pages 44 and 45 you will find a listing for the ThreadPriority2.cs file.  Here is the corrected code.

using System;

using System.Threading;

namespace ThreadPriority2


class ThreadPriority


public static Thread worker;

public static Thread worker2;

static void Main(string[] args)


Console.WriteLine("Entering void Main()");

worker = new Thread(new ThreadStart(FindPriority));

worker2 = new Thread(new ThreadStart(FindPriority));

// Lets give a name to the thread

worker.Name = "FindPriority() Thread";

worker2.Name = "FindPriority() Thread 2";

// Give the new thread object the highest priority

worker2.Priority = System.Threading.ThreadPriority.Highest;



Console.WriteLine("Exiting void main()");



public static void FindPriority()


Console.WriteLine("Name: " + Thread.CurrentThread.Name);

Console.WriteLine("State: " + Thread.CurrentThread.ThreadState.ToString());

Console.WriteLine("Priority: " + Thread.CurrentThread.Priority.ToString());






The only difference is that in the book the FindPriority routine, the original code refers to the thread variable “worker.” as opposed to “Thread.CurrentThread.”

Posted on Sunday, May 28, 2006 10:45 PM Stupid Code Tricks | Back to top

Comments on this post: Wrox "C# Threading Handbook" Errata - Part 1

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Malcolm Anderson | Powered by: