Changeset 42235 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Jul 19, 2012 5:02:41 PM (13 years ago)
- Location:
- trunk/src/VBox/Runtime/generic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/generic/timer-generic.cpp
r39083 r42235 5 5 6 6 /* 7 * Copyright (C) 2006-20 07Oracle Corporation7 * Copyright (C) 2006-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 159 159 160 160 /* 161 * If the timer is active, we just flag it to self destruct on the next tick. 162 * If it's suspended we can safely set the destroy flag and signal it. 161 * If the timer is active, we stop and destruct it in one go, to avoid 162 * unnecessary waiting for the next tick. If it's suspended we can safely 163 * set the destroy flag and signal it. 163 164 */ 164 165 RTTHREAD Thread = pTimer->Thread; 165 166 if (!pTimer->fSuspended) 166 {167 167 ASMAtomicXchgU8(&pTimer->fSuspended, true); 168 ASMAtomicXchgU8(&pTimer->fDestroyed, true); 169 } 170 else 171 { 172 ASMAtomicXchgU8(&pTimer->fDestroyed, true); 173 int rc = RTSemEventSignal(pTimer->Event); 174 if (rc == VERR_ALREADY_POSTED) 175 rc = VINF_SUCCESS; 176 AssertRC(rc); 177 } 168 ASMAtomicXchgU8(&pTimer->fDestroyed, true); 169 int rc = RTSemEventSignal(pTimer->Event); 170 if (rc == VERR_ALREADY_POSTED) 171 rc = VINF_SUCCESS; 172 AssertRC(rc); 178 173 179 174 RTThreadWait(Thread, 250, NULL); -
trunk/src/VBox/Runtime/generic/timerlr-generic.cpp
r41774 r42235 8 8 9 9 /* 10 * Copyright (C) 2006-20 08Oracle Corporation10 * Copyright (C) 2006-2012 Oracle Corporation 11 11 * 12 12 * This file is part of VirtualBox Open Source Edition (OSE), as … … 154 154 155 155 /* 156 * If the timer is active, we just flag it to self destruct on the next tick. 157 * If it's suspended we can safely set the destroy flag and signal it. 156 * If the timer is active, we stop and destruct it in one go, to avoid 157 * unnecessary waiting for the next tick. If it's suspended we can safely 158 * set the destroy flag and signal it. 158 159 */ 159 160 RTTHREAD hThread = pThis->hThread; 160 161 if (!pThis->fSuspended) 161 {162 162 ASMAtomicWriteBool(&pThis->fSuspended, true); 163 ASMAtomicWriteBool(&pThis->fDestroyed, true); 164 } 165 else 166 { 167 ASMAtomicWriteBool(&pThis->fDestroyed, true); 168 int rc = RTSemEventSignal(pThis->hEvent); 169 if (rc == VERR_ALREADY_POSTED) 170 rc = VINF_SUCCESS; 171 AssertRC(rc); 172 } 173 174 RTThreadWait(hThread, 500, NULL); /* 250 ms was not enough for valgrind! */ 163 ASMAtomicWriteBool(&pThis->fDestroyed, true); 164 int rc = RTSemEventSignal(pThis->hEvent); 165 if (rc == VERR_ALREADY_POSTED) 166 rc = VINF_SUCCESS; 167 AssertRC(rc); 168 169 RTThreadWait(hThread, 250, NULL); 175 170 return VINF_SUCCESS; 176 171 }
Note:
See TracChangeset
for help on using the changeset viewer.