Changeset 52016 in vbox for trunk/src/VBox/Main/include
- Timestamp:
- Jul 14, 2014 12:31:48 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 94983
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/objectslist.h
r44529 r52016 125 125 void uninitAll() 126 126 { 127 /* The implementation differs from the high level description, because 128 * it isn't safe to hold any locks when invoking uninit() methods. It 129 * leads to incorrect lock order (first lock, then the Caller related 130 * event semaphore) and thus deadlocks. Dropping the lock is vital, 131 * and means we can't rely on iterators while not holding the lock. */ 127 132 AutoWriteLock al(m_lock COMMA_LOCKVAL_SRC_POS); 128 for (iterator it = m_ll.begin(); 129 it != m_ll.end(); 130 ++it) 133 while (!m_ll.empty()) 131 134 { 132 MyType &q = *it; 135 /* Need a copy of the element, have to delete the entry before 136 * dropping the lock, otherwise someone else might mess with the 137 * list in the mean time, leading to erratic behavior. */ 138 MyType q = m_ll.front(); 139 m_ll.pop_front(); 140 al.release(); 133 141 q->uninit(); 142 al.acquire(); 134 143 } 135 m_ll.clear();136 144 } 137 145
Note:
See TracChangeset
for help on using the changeset viewer.