thread-r0drv-nt.cpp revision 7f9158d55774800c9b8f2d35fde872c7434fd281
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * IPRT - Threads, Ring-0 Driver, NT.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (C) 2006-2007 Oracle Corporation
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * This file is part of VirtualBox Open Source Edition (OSE), as
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * available from http://www.virtualbox.org. This file is free software;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * you can redistribute it and/or modify it under the terms of the GNU
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * General Public License (GPL) as published by the Free Software
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Foundation, in version 2 as it comes in the "COPYING" file of the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file may alternatively be used under the terms
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of the Common Development and Distribution License Version 1.0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * VirtualBox OSE distribution, in which case the provisions of the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * CDDL are applicable instead of those of the GPL.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You may elect to license modified versions of this file under the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * terms and conditions of either the GPL or the CDDL or both.
f015d695b84915f1c2c3fcf81f339548af1852c4Peter Major/*******************************************************************************
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster* Header Files *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster*******************************************************************************/
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterstatic int rtR0ThreadNtSleepCommon(RTMSINTERVAL cMillies)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Interval.QuadPart = -(int64_t)cMillies * 10000;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster NTSTATUS rcNt = KeDelayExecutionThread(KernelMode, TRUE, &Interval);
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterRTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterRTDECL(int) RTThreadSleepCommon(RTMSINTERVAL cMillies)
f015d695b84915f1c2c3fcf81f339548af1852c4Peter Major return ZwYieldExecution() != STATUS_NO_YIELD_PERFORMED;
f015d695b84915f1c2c3fcf81f339548af1852c4Peter MajorRTDECL(bool) RTThreadPreemptIsEnabled(RTTHREAD hThread)
if (!ASMIntAreEnabled())
bool fPending;
#ifdef RT_ARCH_X86
if ( !fPending
&& offDpcQueueDepth)
return fPending;
return g_offrtNtPbQuantumEnd != 0
&& g_cbrtNtPbQuantumEnd != 0
&& g_offrtNtPbDpcQueueDepth != 0;