VirtualBox

source: vbox/trunk/src/VBox/Runtime/include/internal/lockvalidator.h@ 31964

Last change on this file since 31964 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
1/* $Id: lockvalidator.h 28800 2010-04-27 08:22:32Z vboxsync $ */
2/** @file
3 * IPRT - Internal RTLockValidator header.
4 */
5
6/*
7 * Copyright (C) 2006-2009 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 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27#ifndef ___iprt_internal_lockvalidator_h
28#define ___iprt_internal_lockvalidator_h
29
30#include <iprt/types.h>
31#include <iprt/lockvalidator.h>
32#include "internal/lockvalidator.h"
33
34RT_C_DECLS_BEGIN
35
36
37/**
38 * Record used only on the lock stack for recording the stack and source
39 * position of a recursive lock acquisition.
40 */
41typedef struct RTLOCKVALRECNEST
42{
43 RTLOCKVALRECCORE Core;
44 /** The recursion level at this point in the stack. */
45 uint32_t cRecursion;
46 /** Pointer to the next record on the stack. */
47 PRTLOCKVALRECUNION volatile pDown;
48 /** Pointer to the first recursion. */
49 PRTLOCKVALRECUNION volatile pRec;
50 /** Pointer to the next free record when in the
51 * RTLOCKVALPERTHREAD::pFreeNestRecs list. */
52 struct RTLOCKVALRECNEST *pNextFree;
53 /** The source position. */
54 RTLOCKVALSRCPOS SrcPos;
55} RTLOCKVALRECNEST;
56/** Pointer to a recursion record. */
57typedef RTLOCKVALRECNEST *PRTLOCKVALRECNEST;
58
59
60/**
61 * Record union for simplifying internal processing.
62 */
63typedef union RTLOCKVALRECUNION
64{
65 RTLOCKVALRECCORE Core;
66 RTLOCKVALRECEXCL Excl;
67 RTLOCKVALRECSHRD Shared;
68 RTLOCKVALRECSHRDOWN ShrdOwner;
69 RTLOCKVALRECNEST Nest;
70} RTLOCKVALRECUNION;
71
72
73/**
74 * Per thread data for the lock validator.
75 *
76 * This is part of the RTTHREADINT structure.
77 */
78typedef struct RTLOCKVALPERTHREAD
79{
80 /** Where we are blocking. */
81 RTLOCKVALSRCPOS SrcPos;
82 /** Top of the lock stack. */
83 PRTLOCKVALRECUNION volatile pStackTop;
84 /** List of free recursion (nesting) record. */
85 PRTLOCKVALRECNEST pFreeNestRecs;
86 /** What we're blocking on.
87 * The lock validator sets this, RTThreadUnblock clears it. */
88 PRTLOCKVALRECUNION volatile pRec;
89 /** The state in which pRec that goes with pRec.
90 * RTThreadUnblocking uses this to figure out when to clear pRec. */
91 RTTHREADSTATE volatile enmRecState;
92 /** The thread is running inside the lock validator. */
93 bool volatile fInValidator;
94 /** Reserved for alignment purposes. */
95 bool afReserved[3];
96 /** Number of registered write locks, mutexes and critsects that this thread owns. */
97 int32_t volatile cWriteLocks;
98 /** Number of registered read locks that this thread owns, nesting included. */
99 int32_t volatile cReadLocks;
100 /** Bitmap indicating which entires are free (set) and allocated (clear). */
101 uint32_t volatile bmFreeShrdOwners;
102 /** Reserved for alignment purposes. */
103 uint32_t u32Reserved;
104 /** Statically allocated shared owner records */
105 RTLOCKVALRECSHRDOWN aShrdOwners[32];
106} RTLOCKVALPERTHREAD;
107
108
109DECLHIDDEN(void) rtLockValidatorInitPerThread(RTLOCKVALPERTHREAD *pPerThread);
110DECLHIDDEN(void) rtLockValidatorDeletePerThread(RTLOCKVALPERTHREAD *pPerThread);
111DECLHIDDEN(void) rtLockValidatorSerializeDestructEnter(void);
112DECLHIDDEN(void) rtLockValidatorSerializeDestructLeave(void);
113
114RT_C_DECLS_END
115
116#endif
117
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