<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'How does Sleep sleep?' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'How does Sleep sleep?' posted on the 'C#' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Wed, 19 Jun 2013 22:26:38 -0700</pubDate>
    <lastBuildDate>Wed, 19 Jun 2013 22:26:38 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>How does Sleep sleep?</title>
      <link>http://www.programmersheaven.com/mb/csharp/329336/329336/how-does-sleep-sleep/</link>
      <description>Hi,&lt;br /&gt;
&lt;br /&gt;
first look what I mean with Sleep and MySleep.&lt;br /&gt;
&lt;br /&gt;
Sleep:&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
System.Threading.Thread.Sleep(5000);
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
MySleep:&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
DateTime DT = DateTime.Now;
while (((TimeSpan)(DateTime.Now - DT)).TotalMilliseconds &amp;lt; 5000) ;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
If you use Sleep, you will see no CPU-Usage-Maximum in the TaskManager.&lt;br /&gt;
But if you use MySleep, the CPU will reach a usage max. I understand why MySleep use the CPU, but why does Sleep don't?&lt;br /&gt;
&lt;br /&gt;
How does Sleep sleep?&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/csharp/329336/329336/how-does-sleep-sleep/</guid>
      <pubDate>Tue, 14 Feb 2006 00:17:48 -0700</pubDate>
      <category>C#</category>
    </item>
    <item>
      <title>Re: How does Sleep sleep?</title>
      <link>http://www.programmersheaven.com/mb/csharp/329336/329338/re-how-does-sleep-sleep/#329338</link>
      <description>I think Sleep calls for Win32 API function Sleep which then tells Operating System "this thread is sleeping now for 5000 ms." After this process scheduler (this gets really deep into OS) schedules sleeping thread away and sets another thread into run. When scheduler has gone through every thread in the system it sees our sleeping thread. It checks if its still sleaping and if not, it starts scheduling some processor time for it again.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/csharp/329336/329338/re-how-does-sleep-sleep/#329338</guid>
      <pubDate>Tue, 14 Feb 2006 00:23:47 -0700</pubDate>
      <category>C#</category>
    </item>
    <item>
      <title>Re: How does Sleep sleep?</title>
      <link>http://www.programmersheaven.com/mb/csharp/329336/329360/re-how-does-sleep-sleep/#329360</link>
      <description>: I think Sleep calls for Win32 API function Sleep which then tells Operating System "this thread is sleeping now for 5000 ms." After this process scheduler (this gets really deep into OS) schedules sleeping thread away and sets another thread into run. When scheduler has gone through every thread in the system it sees our sleeping thread. It checks if its still sleaping and if not, it starts scheduling some processor time for it again.&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
Thx for this. My thirst for knowledge is satisfied.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/csharp/329336/329360/re-how-does-sleep-sleep/#329360</guid>
      <pubDate>Tue, 14 Feb 2006 05:04:02 -0700</pubDate>
      <category>C#</category>
    </item>
  </channel>
</rss>