Changeset 25894 in vbox for trunk/src/VBox
- Timestamp:
- Jan 18, 2010 2:16:58 PM (15 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r25880 r25894 175 175 Data() 176 176 : pMainConfigFile(NULL), 177 ollMachines(LOCKCLASS_LISTOFMACHINES), 178 ollGuestOSTypes(LOCKCLASS_LISTOFOTHEROBJECTS), 179 ollHardDisks(LOCKCLASS_LISTOFMEDIA), 180 ollDVDImages(LOCKCLASS_LISTOFMEDIA), 181 ollFloppyImages(LOCKCLASS_LISTOFMEDIA), 182 ollSharedFolders(LOCKCLASS_LISTOFOTHEROBJECTS), 183 ollDHCPServers(LOCKCLASS_LISTOFOTHEROBJECTS), 177 lockMachines(LOCKCLASS_LISTOFMACHINES), 178 ollMachines(lockMachines), 179 lockGuestOSTypes(LOCKCLASS_LISTOFOTHEROBJECTS), 180 ollGuestOSTypes(lockGuestOSTypes), 181 lockMedia(LOCKCLASS_LISTOFMEDIA), 182 ollHardDisks(lockMedia), 183 ollDVDImages(lockMedia), 184 ollFloppyImages(lockMedia), 185 lockSharedFolders(LOCKCLASS_LISTOFOTHEROBJECTS), 186 ollSharedFolders(lockSharedFolders), 187 lockDHCPServers(LOCKCLASS_LISTOFOTHEROBJECTS), 188 ollDHCPServers(lockDHCPServers), 184 189 mtxProgressOperations(LOCKCLASS_PROGRESSLIST), 185 190 updateReq(UPDATEREQARG), … … 203 208 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 204 209 205 // the following lists all have an RWLockHandle as a member and are locked 206 // individually; getting the VirtualBox object lock is NOT necessary, but 207 // see the remarks which ObjectsList method lock themselves and which require 208 // external locking 210 // Each of the following lists use a particular lock handle that protects the 211 // list as a whole. As opposed to version 3.1 and earlier, these lists no 212 // longer need the main VirtualBox object lock, but only the respective list 213 // lock. In each case, the locking order is defined that the list must be 214 // requested before object locks of members of the lists (see the order definitions 215 // in AutoLock.h; e.g. LOCKCLASS_LISTOFMACHINES before LOCKCLASS_MACHINEOBJECT). 216 RWLockHandle lockMachines; 209 217 MachinesOList ollMachines; 218 219 RWLockHandle lockGuestOSTypes; 210 220 GuestOSTypesOList ollGuestOSTypes; 211 221 212 MediaOList ollHardDisks, // only base hard disks; the RWLockHandle in here is also used 213 // for hardDiskTreeLockHandle() 222 // All the media lists are protected by the following locking handle: 223 RWLockHandle lockMedia; 224 MediaOList ollHardDisks, 214 225 ollDVDImages, 215 226 ollFloppyImages; 227 // the hard disks map is an additional map sorted by UUID for quick lookup 228 // and contains ALL hard disks (base and differencing); it is protected by 229 // the same lock as the other media lists above 230 HardDiskMap mapHardDisks; 231 232 RWLockHandle lockSharedFolders; 216 233 SharedFoldersOList ollSharedFolders; 234 235 RWLockHandle lockDHCPServers; 217 236 DHCPServersOList ollDHCPServers; 218 237 219 // the hard disks map is an additional map sorted by UUID for quick lookup 220 // and contains ALL hard disks (base and differencing); 221 // the map must also be protected by ollHardDisks.getLockHandle()! 222 HardDiskMap mapHardDisks; 223 238 RWLockHandle mtxProgressOperations; 224 239 ProgressMap mapProgressOperations; 225 240 CallbackList llCallbacks; 226 241 227 RWLockHandle mtxProgressOperations;228 242 229 243 // the following are data for the client watcher thread … … 3658 3672 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 3659 3673 3660 ObjectsList<Medium> ollAll(LOCKCLASS_LISTOFMEDIA); 3674 RWLockHandle tmpLock(LOCKCLASS_LISTOFMEDIA); // not really necessary but the ObjectsList<> constructor wants one 3675 ObjectsList<Medium> ollAll(tmpLock); 3661 3676 ollAll.appendOtherList(m->ollDVDImages); 3662 3677 ollAll.appendOtherList(m->ollFloppyImages); -
trunk/src/VBox/Main/include/objectslist.h
r25834 r25894 59 59 // http://www.parashift.com/c++-faq-lite/templates.html#faq-35.18 60 60 61 ObjectsList( VBoxLockingClass lockClass)62 : m_lock(lock Class)61 ObjectsList(RWLockHandle &lockHandle) 62 : m_lock(lockHandle) 63 63 { } 64 64 … … 201 201 private: 202 202 MyList m_ll; 203 RWLockHandle m_lock;203 RWLockHandle &m_lock; 204 204 }; 205 205
Note:
See TracChangeset
for help on using the changeset viewer.