1 | /* $Id: TMInline.h 69111 2017-10-17 14:26:02Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * TM - Common Inlined functions.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2017 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 | */
|
---|
30 | DECL_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 |
|
---|