Files
mirror-processhacker/trunk/ProcessHacker.Native/Threading/CurrentThread.cs
T
wj32 6ce92df241 fixed CurrentThread.Sleep(int)
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@1348 21ef857c-d57f-4fe0-8362-d861dc6d29cd
2009-05-30 05:28:26 +00:00

49 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
namespace ProcessHacker.Native.Threading
{
/// <summary>
/// Provides methods for manipulating the current thread.
/// </summary>
public static class CurrentThread
{
/// <summary>
/// Switches to another thread.
/// </summary>
public static void Sleep()
{
Yield();
}
/// <summary>
/// Suspends execution of the current thread.
/// </summary>
/// <param name="interval">The interval to sleep, in milliseconds.</param>
public static void Sleep(int interval)
{
ThreadHandle.Sleep(interval * Win32.TimeMsTo100Ns, true);
}
/// <summary>
/// Suspends execution of the current thread.
/// </summary>
/// <param name="time">The time at which wake up.</param>
public static void Sleep(DateTime time)
{
ThreadHandle.Sleep(time.ToFileTime(), false);
}
/// <summary>
/// Switches to another thread.
/// </summary>
public static void Yield()
{
ThreadHandle.Yield();
}
}
}