title: Thread.Sleep(0) doesn't work as described?
body: <p>I am currently reading <a href="http://www.albahari.com/threading/">this excellent article</a> on threading and read the following text:</p>
  
  <blockquote>
    <p>Thread.Sleep(0) relinquishes the thread’s current time slice immediately, voluntarily handing over the CPU to other threads.</p>
  </blockquote>
  
  <p>I wanted to test this and below is my test code:</p>
  
  <pre><code>static string s = "";
  
  static void Main(string[] args)
  {
      //Create two threads that append string s
      Thread threadPoints = new Thread(SetPoints);
      Thread threadNewLines = new Thread(SetNewLines);
  
      //Start threads
      threadPoints.Start();
      threadNewLines.Start();
  
      //Wait one second for threads to manipulate string s
      Thread.Sleep(1000);
  
      //Threads have an infinite loop so we have to close them forcefully. 
      threadPoints.Abort();
      threadNewLines.Abort();
  
      //Print string s and wait for user-input
      Console.WriteLine(s);
      Console.ReadKey();
  }
  </code></pre>
  
  <p>The functions that threadPoints and threadNewLines run:</p>
  
  <pre><code>static void SetPoints()
  {
      while(true)
      {
          s += ".";
      }
  }
  
  static void SetNewLines()
  {
      while(true)
      {
          s += "\n";
          Thread.Sleep(0);
      }
  }
  </code></pre>
  
  <p>If I understand Thread.Sleep(0) correctly, the output should be something like this:</p>
  
  <pre><code>............        |
  ..............      |
  ................    | &lt;- End of console
  ..........          |
  .............       |
  ...............     |
  </code></pre>
  
  <p>But I get this as output:</p>
  
  <pre><code>....................|
  ....................|
  ....                |
                      |
                      |
  ....................|
  ....................|
  .................   |
                      |
  </code></pre>
  
  <p>Seeing as the article mentioned in the beginning of the post is highly recommended by many programmers, I can only assume that my understanding of Thread.Sleep(0) is wrong. So if someone could clarify, I'd be much obliged.</p>