Pal/Thread.Dos.cs

(完整代码) 850B

using System;
using System.Runtime.CompilerServices;

namespace System.Threading
{
    static class Thread
    {
        public static unsafe void Sleep(int delayMs)
        {
            // Place the sequence of bytes 0xF4, 0xC3 on the stack.
            // The bytes correspond to the following assembly instruction sequence:
            //
            // hlt
            // ret
            //
            ushort hlt = 0xc3f4;

            long expected = Environment.TickCount64 + delayMs;
            while (Environment.TickCount64 < expected)
            {
                // Call the helper we placed on the stack to halt the processor
                // for a little bit.
                // (Security people are crying in a corner right now).
                ClassConstructorRunner.Call<int>(new IntPtr(&hlt));
            }
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。