1 | /* $Id: TMInline.h 76585 2019-01-01 06:31:29Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * TM - Common Inlined functions.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2019 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 VMM_INCLUDED_SRC_include_TMInline_h
|
---|
19 | #define VMM_INCLUDED_SRC_include_TMInline_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * Used to unlink a timer from the active list.
|
---|
27 | *
|
---|
28 | * @param pQueue The timer queue.
|
---|
29 | * @param pTimer The timer that needs linking.
|
---|
30 | *
|
---|
31 | * @remarks Called while owning the relevant queue lock.
|
---|
32 | */
|
---|
33 | DECL_FORCE_INLINE(void) tmTimerQueueUnlinkActive(PTMTIMERQUEUE pQueue, PTMTIMER pTimer)
|
---|
34 | {
|
---|
35 | #ifdef VBOX_STRICT
|
---|
36 | TMTIMERSTATE const enmState = pTimer->enmState;
|
---|
37 | Assert( pTimer->enmClock == TMCLOCK_VIRTUAL_SYNC
|
---|
38 | ? enmState == TMTIMERSTATE_ACTIVE
|
---|
39 | : enmState == TMTIMERSTATE_PENDING_SCHEDULE || enmState == TMTIMERSTATE_PENDING_STOP_SCHEDULE);
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | const PTMTIMER pPrev = TMTIMER_GET_PREV(pTimer);
|
---|
43 | const PTMTIMER pNext = TMTIMER_GET_NEXT(pTimer);
|
---|
44 | if (pPrev)
|
---|
45 | TMTIMER_SET_NEXT(pPrev, pNext);
|
---|
46 | else
|
---|
47 | {
|
---|
48 | TMTIMER_SET_HEAD(pQueue, pNext);
|
---|
49 | pQueue->u64Expire = pNext ? pNext->u64Expire : INT64_MAX;
|
---|
50 | DBGFTRACE_U64_TAG(pTimer->CTX_SUFF(pVM), pQueue->u64Expire, "tmTimerQueueUnlinkActive");
|
---|
51 | }
|
---|
52 | if (pNext)
|
---|
53 | TMTIMER_SET_PREV(pNext, pPrev);
|
---|
54 | pTimer->offNext = 0;
|
---|
55 | pTimer->offPrev = 0;
|
---|
56 | }
|
---|
57 |
|
---|
58 | #endif /* !VMM_INCLUDED_SRC_include_TMInline_h */
|
---|
59 |
|
---|