timerlr-generic.cpp revision 9621896680fea9b2078823e8ef2e64cec5bf2da0
2N/A * IPRT - Low Resolution Timers, Generic. 2N/A * bugfixes goes into both files. 2N/A * Copyright (C) 2006-2008 Sun Microsystems, Inc. 2N/A * This file is part of VirtualBox Open Source Edition (OSE), as 2N/A * you can redistribute it and/or modify it under the terms of the GNU 2N/A * General Public License (GPL) as published by the Free Software 2N/A * Foundation, in version 2 as it comes in the "COPYING" file of the 2N/A * VirtualBox OSE distribution. VirtualBox OSE is distributed in the 2N/A * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 2N/A * The contents of this file may alternatively be used under the terms 2N/A * of the Common Development and Distribution License Version 1.0 2N/A * (CDDL) only, as it comes in the "COPYING.CDDL" file of the 2N/A * VirtualBox OSE distribution, in which case the provisions of the 2N/A * CDDL are applicable instead of those of the GPL. 2N/A * You may elect to license modified versions of this file under the 2N/A * terms and conditions of either the GPL or the CDDL or both. 2N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa 2N/A * additional information or have any questions. 2N/A/******************************************************************************* 2N/A*******************************************************************************/ 2N/A/******************************************************************************* 2N/A* Structures and Typedefs * 2N/A*******************************************************************************/ 2N/A * The internal representation of a timer handle. 2N/A * This is RTTIMERRT_MAGIC, but changes to something else before the timer 2N/A * is destroyed to indicate clearly that thread should exit. */ 2N/A /** Flag indicating the timer is suspended. */ 2N/A /** Flag indicating that the timer has been destroyed. */ 2N/A /** User argument. */ 2N/A /** The timer thread. */ 2N/A /** Event semaphore on which the thread is blocked. */ 2N/A /** The timer interval. 0 if one-shot. */ 2N/A /** The start of the current run (ns). 2N/A * This is used to calculate when the timer ought to fire the next time. */ /** The start of the current run (ns). * This is used to calculate when the timer ought to fire the next time. */ /** The current tick number (since u64StartTS). */ /******************************************************************************* *******************************************************************************/ * We don't support the fancy MP features, nor intervals lower than 100 ms. * Allocate and initialize the timer handle. * Validate input, NIL is fine though. * If the timer is active, we just flag it to self destruct on the next tick. * If it's suspended we can safely set the destroy flag and signal it. * Calc when it should start fireing and give the thread a kick so it get going. * Mark it as suspended and kick the thread. /* calc the next time we should fire. */ #
ifdef IN_RING3 /* In ring-3 we'll catch up lost ticks immediately. */#
ifdef IN_RING3 /* In ring-3 we'll catch up lost ticks immediately. */ * Release the timer resources.