- Timestamp:
- Dec 2, 2010 6:16:04 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 68444
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/VirtualBoxClientImpl.cpp
r34424 r34642 22 22 #include "Logging.h" 23 23 24 #include <iprt/asm.h> 24 25 #include <iprt/thread.h> 25 26 #include <iprt/critsect.h> … … 32 33 33 34 35 /** Initialize instance counter class variable */ 36 uint32_t VirtualBoxClient::g_cInstances = 0; 37 38 34 39 // constructor / destructor 35 40 ///////////////////////////////////////////////////////////////////////////// … … 62 67 AssertReturn(autoInitSpan.isOk(), E_FAIL); 63 68 69 mData.m_ThreadWatcher = NIL_RTTHREAD; 70 mData.m_SemEvWatcher = NIL_RTSEMEVENT; 71 72 if (ASMAtomicIncU32(&g_cInstances) != 1) 73 AssertFailedReturn(E_FAIL); 74 64 75 rc = unconst(mData.m_pVirtualBox).createLocalObject(CLSID_VirtualBox); 65 76 AssertComRCReturnRC(rc); … … 73 84 * is not considered important enough to cause any sort of visible 74 85 * failure. The monitoring will not be done, but that's all. */ 75 mData.m_ThreadWatcher = NIL_RTTHREAD;76 86 int vrc = RTSemEventCreate(&mData.m_SemEvWatcher); 77 87 AssertRC(vrc); … … 107 117 if (autoUninitSpan.uninitDone()) 108 118 return; 109 110 unconst(mData.m_pVirtualBox).setNull();111 119 112 120 if (mData.m_ThreadWatcher != NIL_RTTHREAD) … … 121 129 mData.m_SemEvWatcher = NIL_RTSEMEVENT; 122 130 } 131 132 unconst(mData.m_pVirtualBox).setNull(); 133 134 ASMAtomicDecU32(&g_cInstances); 123 135 } 124 136 -
trunk/src/VBox/Main/include/VirtualBoxClientImpl.h
r34424 r34642 38 38 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(VirtualBoxClient, IVirtualBoxClient) 39 39 40 DECLARE_CLASSFACTORY _SINGLETON(VirtualBoxClient)40 DECLARE_CLASSFACTORY() 41 41 42 42 DECLARE_REGISTRY_RESOURCEID(IDR_VIRTUALBOX) … … 64 64 65 65 private: 66 /** Instance counter for simulating something similar to a singleton. 67 * Only the first instance will be a usable object, all additional 68 * instances will return a failure at creation time and will not work. */ 69 static uint32_t g_cInstances; 66 70 67 71 static DECLCALLBACK(int) SVCWatcherThread(RTTHREAD ThreadSelf, void *pvUser);
Note:
See TracChangeset
for help on using the changeset viewer.