title: Thread.Sleep() in a Portable Class Library
body: <p>The <em>MSDN</em> docs say <code>Thread.Sleep()</code> can be used in a <em>portable</em> class library. The compiler says otherwise. What are my alternatives besides a spin-loop? <code>Thread.CurrentThread.Join()</code> doesn't exist either.</p>
  
  <p>Project file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
    &lt;PropertyGroup&gt;
      &lt;Configuration Condition=" '$(Configuration)' == '' "&gt;Debug&lt;/Configuration&gt;
      &lt;Platform Condition=" '$(Platform)' == '' "&gt;AnyCPU&lt;/Platform&gt;
      &lt;ProjectGuid&gt;{C46B138E-CC30-4397-B326-8DD019E3874B}&lt;/ProjectGuid&gt;
      &lt;OutputType&gt;Library&lt;/OutputType&gt;
      &lt;AppDesignerFolder&gt;Properties&lt;/AppDesignerFolder&gt;
      &lt;RootNamespace&gt;x0xtest.AVR&lt;/RootNamespace&gt;
      &lt;AssemblyName&gt;x0xtest.AVR&lt;/AssemblyName&gt;
      &lt;TargetFrameworkVersion&gt;v4.0&lt;/TargetFrameworkVersion&gt;
      &lt;TargetFrameworkProfile&gt;Profile3&lt;/TargetFrameworkProfile&gt;
      &lt;FileAlignment&gt;512&lt;/FileAlignment&gt;
      &lt;ProjectTypeGuids&gt;{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}&lt;/ProjectTypeGuids&gt;
    &lt;/PropertyGroup&gt;
    &lt;PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "&gt;
      &lt;DebugSymbols&gt;true&lt;/DebugSymbols&gt;
      &lt;DebugType&gt;full&lt;/DebugType&gt;
      &lt;Optimize&gt;false&lt;/Optimize&gt;
      &lt;OutputPath&gt;bin\Debug\&lt;/OutputPath&gt;
      &lt;DefineConstants&gt;DEBUG;TRACE&lt;/DefineConstants&gt;
      &lt;ErrorReport&gt;prompt&lt;/ErrorReport&gt;
      &lt;WarningLevel&gt;4&lt;/WarningLevel&gt;
    &lt;/PropertyGroup&gt;
    &lt;PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "&gt;
      &lt;DebugType&gt;pdbonly&lt;/DebugType&gt;
      &lt;Optimize&gt;true&lt;/Optimize&gt;
      &lt;OutputPath&gt;bin\Release\&lt;/OutputPath&gt;
      &lt;DefineConstants&gt;TRACE&lt;/DefineConstants&gt;
      &lt;ErrorReport&gt;prompt&lt;/ErrorReport&gt;
      &lt;WarningLevel&gt;4&lt;/WarningLevel&gt;
    &lt;/PropertyGroup&gt;
    &lt;ItemGroup&gt;
      &lt;Reference Include="System" /&gt;
      &lt;Reference Include="System.Core" /&gt;
    &lt;/ItemGroup&gt;
    &lt;ItemGroup&gt;
      &lt;Compile Include="Attributes\AddressAttribute.cs" /&gt;
      &lt;Compile Include="Attributes\RegAttribute.cs" /&gt;
      &lt;Compile Include="Attributes\ROAttribute.cs" /&gt;
      &lt;Compile Include="Attributes\RWAttribute.cs" /&gt;
      &lt;Compile Include="Attributes\WOAttribute.cs" /&gt;
      &lt;Compile Include="Devices\ATMega162.cs" /&gt;
      &lt;Compile Include="Exceptions.cs" /&gt;
      &lt;Compile Include="IntelHexFormat.cs" /&gt;
      &lt;Compile Include="Properties\AssemblyInfo.cs" /&gt;
      &lt;Compile Include="Proxy.cs" /&gt;
      &lt;Compile Include="ProxyBase.cs" /&gt;
      &lt;Compile Include="ProxyBase_UploadFirmware.cs" /&gt;
    &lt;/ItemGroup&gt;
    &lt;ItemGroup&gt;
      &lt;ProjectReference Include="..\x0xtest.Comm\x0xtest.Comm.csproj"&gt;
        &lt;Project&gt;{F78547AC-1CA1-4ADB-9FA8-3E7DEB682240}&lt;/Project&gt;
        &lt;Name&gt;x0xtest.Comm&lt;/Name&gt;
      &lt;/ProjectReference&gt;
    &lt;/ItemGroup&gt;
    &lt;Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" /&gt;
    &lt;!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
         Other similar extension points exist, see Microsoft.Common.targets.
    &lt;Target Name="BeforeBuild"&gt;
    &lt;/Target&gt;
    &lt;Target Name="AfterBuild"&gt;
    &lt;/Target&gt;
    --&gt;
  &lt;/Project&gt;
  </code></pre>