Changeset 57228 in vbox for trunk/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp
- Timestamp:
- Aug 6, 2015 11:27:10 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp
r56290 r57228 70 70 { 71 71 RT_ASSERT_PREEMPTIBLE(); 72 IPRT_DARWIN_SAVE_EFL_AC(); 72 73 AssertReturn(fFlags == RTSPINLOCK_FLAGS_INTERRUPT_SAFE || fFlags == RTSPINLOCK_FLAGS_INTERRUPT_UNSAFE, VERR_INVALID_PARAMETER); 73 74 … … 77 78 AssertCompile(sizeof(RTSPINLOCKINTERNAL) > sizeof(void *)); 78 79 PRTSPINLOCKINTERNAL pThis = (PRTSPINLOCKINTERNAL)RTMemAlloc(sizeof(*pThis)); 79 if (!pThis) 80 return VERR_NO_MEMORY; 80 if (pThis) 81 { 82 /* 83 * Initialize & return. 84 */ 85 pThis->u32Magic = RTSPINLOCK_MAGIC; 86 pThis->fIntSaved = 0; 87 pThis->fFlags = fFlags; 88 pThis->pszName = pszName; 89 Assert(g_pDarwinLockGroup); 90 pThis->pSpinLock = lck_spin_alloc_init(g_pDarwinLockGroup, LCK_ATTR_NULL); 91 if (pThis->pSpinLock) 92 { 93 *pSpinlock = pThis; 94 IPRT_DARWIN_RESTORE_EFL_AC(); 95 return VINF_SUCCESS; 96 } 81 97 82 /*83 * Initialize & return.84 */85 pThis->u32Magic = RTSPINLOCK_MAGIC;86 pThis->fIntSaved = 0;87 pThis->fFlags = fFlags;88 pThis->pszName = pszName;89 Assert(g_pDarwinLockGroup);90 pThis->pSpinLock = lck_spin_alloc_init(g_pDarwinLockGroup, LCK_ATTR_NULL);91 if (!pThis->pSpinLock)92 {93 98 RTMemFree(pThis); 94 return VERR_NO_MEMORY;95 99 } 96 97 *pSpinlock = pThis; 98 return VINF_SUCCESS; 100 IPRT_DARWIN_RESTORE_EFL_AC(); 101 return VERR_NO_MEMORY; 99 102 } 100 103 … … 116 119 */ 117 120 ASMAtomicIncU32(&pThis->u32Magic); 121 IPRT_DARWIN_SAVE_EFL_AC(); 118 122 119 123 Assert(g_pDarwinLockGroup); … … 122 126 123 127 RTMemFree(pThis); 128 129 IPRT_DARWIN_RESTORE_EFL_AC(); 124 130 return VINF_SUCCESS; 125 131 } … … 138 144 lck_spin_lock(pThis->pSpinLock); 139 145 pThis->fIntSaved = fIntSaved; 146 IPRT_DARWIN_RESTORE_EFL_ONLY_AC_EX(fIntSaved); 140 147 } 141 148 else 149 { 150 IPRT_DARWIN_SAVE_EFL_AC(); 142 151 lck_spin_lock(pThis->pSpinLock); 152 IPRT_DARWIN_RESTORE_EFL_ONLY_AC(); 153 } 143 154 } 144 155 … … 158 169 } 159 170 else 171 { 172 IPRT_DARWIN_SAVE_EFL_AC(); 160 173 lck_spin_unlock(pThis->pSpinLock); 174 IPRT_DARWIN_RESTORE_EFL_ONLY_AC(); 175 } 161 176 } 162 177
Note:
See TracChangeset
for help on using the changeset viewer.