Changeset 11597 in vbox
- Timestamp:
- Aug 23, 2008 11:33:52 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/init.cpp
r8245 r11597 64 64 * Global Variables * 65 65 *******************************************************************************/ 66 /** The number of calls to RTR3Init. */ 67 static int32_t volatile g_cUsers = 0; 68 /** Whether we're currently initializing the IPRT. */ 69 static bool volatile g_fInitializing = false; 70 66 71 /** Program path. 67 72 * The size is hardcoded, so we'll have to check for overflow when setting it … … 115 120 /* no entry log flow, because prefixes and thread may freak out. */ 116 121 122 /* 123 * Do reference counting, only initialize the first time around. 124 * 125 * We are ASSUMING that nobody will be able to race RTR3Init calls when the 126 * first one, the real init, is running (second assertion). 127 */ 128 int32_t cUsers = ASMAtomicIncS32(&g_cUsers); 129 if (cUsers != 1) 130 { 131 AssertMsg(cUsers > 1, ("%d\n", cUsers)); 132 Assert(!g_fInitializing); 133 #if !defined(IN_GUEST) && !defined(RT_NO_GIP) 134 if (fInitSUPLib) 135 SUPInit(NULL, cbReserve); 136 #endif 137 } 138 ASMAtomicWriteBool(&g_fInitializing, true); 139 117 140 #if !defined(IN_GUEST) && !defined(RT_NO_GIP) 118 141 # ifdef VBOX … … 142 165 { 143 166 AssertMsgFailed(("Failed to get executable directory path, rc=%d!\n", rc)); 167 ASMAtomicWriteBool(&g_fInitializing, false); 168 ASMAtomicDecS32(&g_cUsers); 144 169 return rc; 145 170 } … … 187 212 { 188 213 AssertMsgFailed(("Failed to get executable directory path, rc=%d!\n", rc)); 214 ASMAtomicWriteBool(&g_fInitializing, false); 215 ASMAtomicDecS32(&g_cUsers); 189 216 return rc; 190 217 } … … 204 231 205 232 LogFlow(("RTR3Init: returns VINF_SUCCESS\n")); 233 ASMAtomicWriteBool(&g_fInitializing, false); 206 234 return VINF_SUCCESS; 207 235 }
Note:
See TracChangeset
for help on using the changeset viewer.