Example #1
0
        public static bool UnsetTimerResolution()
        {
            bool Succeed = false;

            lock (m_ResolutionLock)
            {
                if (m_ResolutionSet)
                {
                    uint currentResolution;
                    uint result = NM.NtSetTimerResolution(m_TimerResolution, false, out currentResolution);

                    switch (result)
                    {
                    case NM.STATUS_SUCCESS:
                        m_ResolutionSet = false;
                        Succeed         = true;
                        break;

                    default:
                        break;
                    }
                }
            }

            return(Succeed);
        }
Example #2
0
        public static bool SetTimerResolution(uint timerResolutionNs)
        {
            bool Succeed = false;

            lock (m_ResolutionLock)
            {
                if (!m_ResolutionSet)
                {
                    uint maximumResolution = GetMaximumTimerResolution();

                    if (timerResolutionNs >= maximumResolution)
                    {
                        uint currentResolution;
                        uint result = NM.NtSetTimerResolution(timerResolutionNs, true, out currentResolution);

                        switch (result)
                        {
                        case NM.STATUS_SUCCESS:
                            m_TimerResolution = timerResolutionNs;
                            m_ResolutionSet   = true;
                            Succeed           = true;
                            break;

                        default:
                            break;
                        }
                    }
                }
            }

            return(Succeed);
        }
Example #3
0
        public static void UnsetMaxTimerResolution()
        {
            if (m_ResolutionSet)
            {
                uint currentResolution;
                uint result = NM.NtSetTimerResolution(m_MaximumResolution, false, out currentResolution);

                switch (result)
                {
                case NM.STATUS_SUCCESS:
                    m_ResolutionSet = false;
                    break;

                default:
                    break;
                }
            }
        }