VirtualBox

source: vbox/trunk/src/VBox/VMM/include/TMInline.h@ 47786

Last change on this file since 47786 was 37517, checked in by vboxsync, 13 years ago

TM: Simplified the virtual sync timers by requiring changes to be done while holding the virtual sync lock. This means we can skip all the pending states and move timers on and off the active list immediately, avoiding the problems with timers being on the pending-scheduling list. Also made u64VirtualSync keep track of the last time stamp all the time (when under the lock) and thus really making sure time does not jump backwards.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
Line 
1/* $Id: TMInline.h 37517 2011-06-16 19:24:00Z vboxsync $ */
2/** @file
3 * TM - Common Inlined functions.
4 */
5
6/*
7 * Copyright (C) 2006-2011 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ___TMInline_h
19#define ___TMInline_h
20
21
22/**
23 * Used to unlink a timer from the active list.
24 *
25 * @param pQueue The timer queue.
26 * @param pTimer The timer that needs linking.
27 *
28 * @remarks Called while owning the relevant queue lock.
29 */
30DECL_FORCE_INLINE(void) tmTimerQueueUnlinkActive(PTMTIMERQUEUE pQueue, PTMTIMER pTimer)
31{
32#ifdef VBOX_STRICT
33 TMTIMERSTATE const enmState = pTimer->enmState;
34 Assert( pTimer->enmClock == TMCLOCK_VIRTUAL_SYNC
35 ? enmState == TMTIMERSTATE_ACTIVE
36 : enmState == TMTIMERSTATE_PENDING_SCHEDULE || enmState == TMTIMERSTATE_PENDING_STOP_SCHEDULE);
37#endif
38
39 const PTMTIMER pPrev = TMTIMER_GET_PREV(pTimer);
40 const PTMTIMER pNext = TMTIMER_GET_NEXT(pTimer);
41 if (pPrev)
42 TMTIMER_SET_NEXT(pPrev, pNext);
43 else
44 {
45 TMTIMER_SET_HEAD(pQueue, pNext);
46 pQueue->u64Expire = pNext ? pNext->u64Expire : INT64_MAX;
47 DBGFTRACE_U64_TAG(pTimer->CTX_SUFF(pVM), pQueue->u64Expire, "tmTimerQueueUnlinkActive");
48 }
49 if (pNext)
50 TMTIMER_SET_PREV(pNext, pPrev);
51 pTimer->offNext = 0;
52 pTimer->offPrev = 0;
53}
54
55#endif
56
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette