Changeset 20630 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jun 16, 2009 1:55:38 PM (15 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r20598 r20630 1891 1891 } 1892 1892 1893 1894 STDMETHODIMP VirtualBox::WaitForEvents(LONG aTimeout)1895 {1896 #ifdef RT_OS_WINDOWS1897 ReturnComNotImplemented();1898 #else1899 extern nsresult XPCOM_waitForEvents(PRInt32 aTimeout);1900 1901 return XPCOM_waitForEvents(aTimeout);1902 #endif1903 }1904 1893 1905 1894 STDMETHODIMP VirtualBox::WaitForPropertyChange (IN_BSTR /* aWhat */, ULONG /* aTimeout */, -
trunk/src/VBox/Main/glue/vboxapi.py
r20598 r20630 145 145 return d['result'] 146 146 147 def waitForEvents(self, timeout): 148 # not really supported yet 149 pass 150 151 def deinit(self): 152 import pythoncom 153 pythoncom.CoUninitialize() 154 pass 155 147 156 class PlatformXPCOM: 148 157 def __init__(self, params): … … 192 201 return d['result'] 193 202 203 def waitForEvents(self, timeout): 204 import xpcom 205 xpcom._xpcom.WaitForEvents(timeout) 206 207 def deinit(self): 208 import xpcom 209 xpcom._xpcom.DeinitCOM() 194 210 195 211 class PlatformWEBSERVICE: … … 235 251 def createCallback(self, iface, impl, arg): 236 252 raise Exception("no callbacks for webservices") 253 254 def waitForEvents(self, timeout): 255 # Webservices cannot do that 256 pass 257 258 def deinit(self): 259 # should we do something about it? 260 pass 237 261 238 262 class SessionManager: … … 269 293 270 294 def __del__(self): 295 deinit(self) 296 297 def deinit(self): 271 298 if hasattr(self, "vbox"): 272 299 del self.vbox 300 if hasattr(self, "platform"): 301 self.platform.deinit() 273 302 274 303 def initPerThread(self): … … 288 317 def createCallback(self, iface, impl, arg): 289 318 return self.platform.createCallback(iface, impl, arg) 319 320 def waitForEvents(self, timeout): 321 return self.platform.waitForEvents(timeout) -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r20598 r20630 2644 2644 <param name="callback" type="IVirtualBoxCallback" dir="in"> 2645 2645 <desc>Callback object to unregister.</desc> 2646 </param>2647 </method>2648 2649 <method name="waitForEvents">2650 <desc>2651 Blocking wait for events to happen and process them, if any.2652 One may wish to call this method from the main even loop2653 to wait for acitivity from VirtualBox, such as callback calling.2654 </desc>2655 <param name="timeout" type="long" dir="in">2656 <desc>2657 Wait timeout in milliseconds.2658 Specify -1 for an indefinite wait.2659 Specify 0 for immediate return if no events to process.2660 </desc>2661 2646 </param> 2662 2647 </method> -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r20598 r20630 180 180 STDMETHOD(UnregisterCallback) (IVirtualBoxCallback *aCallback); 181 181 182 STDMETHOD(WaitForEvents) (LONG aTimeout);183 182 STDMETHOD(WaitForPropertyChange) (IN_BSTR aWhat, ULONG aTimeout, 184 183 BSTR *aChanged, BSTR *aValues); -
trunk/src/VBox/Main/xpcom/server.cpp
r20598 r20630 244 244 static PRBool volatile gKeepRunning = PR_TRUE; 245 245 246 nsresult XPCOM_waitForEvents(PRInt32 aTimeout)247 {248 nsIEventQueue* q = gEventQ;249 PRBool hasEvents = false;250 nsresult rc;251 252 if (!gKeepRunning || !q)253 return NS_OK;254 255 rc = q->PendingEvents(&hasEvents);256 if (NS_FAILED (rc))257 return NS_ERROR_FAILURE;258 259 if (hasEvents)260 {261 q->ProcessPendingEvents();262 return NS_OK;263 }264 265 if (aTimeout == 0)266 return NS_OK;267 268 PRInt32 fd;269 fd = q->GetEventQueueSelectFD();270 271 if (fd < 0 && aTimeout == -1)272 {273 /* fallback */274 PLEvent *pEvent = NULL;275 rc = q->WaitForEvent(&pEvent);276 if (NS_SUCCEEDED(rc))277 q->HandleEvent(pEvent);278 279 q->ProcessPendingEvents();280 return NS_OK;281 }282 283 /* Cannot perform timed wait otherwise */284 AssertReturn(fd >= 0, NS_ERROR_FAILURE);285 286 fd_set fdsetR, fdsetE;287 struct timeval tv;288 289 FD_ZERO(&fdsetR);290 FD_SET(fd, &fdsetR);291 292 fdsetE = fdsetR;293 if (aTimeout > 0)294 {295 /* LogRel(("sleep %d\n", aTimeout)); */296 tv.tv_sec = (PRInt64)aTimeout / 1000;297 tv.tv_usec = ((PRInt64)aTimeout % 1000) * 1000;298 }299 300 /** @todo: What to do for XPCOM platforms w/o select() ? */301 int n = select(fd + 1, &fdsetR, NULL, &fdsetE, aTimeout < 0 ? NULL : &tv);302 rc = (n >= 0) ? NS_OK : NS_ERROR_FAILURE;303 304 /* process pending events, no matter what */305 q->ProcessPendingEvents();306 307 return rc;308 }309 310 246 ///////////////////////////////////////////////////////////////////////////// 311 247 … … 776 712 777 713 /** 778 * H helper function to register self components upon start-up714 * Helper function to register self components upon start-up 779 715 * of the out-of-proc server. 780 716 */
Note:
See TracChangeset
for help on using the changeset viewer.