terminate shell service objects thread if there is nothing to do
Modified: trunk/reactos/subsys/system/explorer/services/shellservices.cpp

Modified: trunk/reactos/subsys/system/explorer/services/shellservices.cpp
--- trunk/reactos/subsys/system/explorer/services/shellservices.cpp	2005-04-02 05:43:37 UTC (rev 14433)
+++ trunk/reactos/subsys/system/explorer/services/shellservices.cpp	2005-04-02 10:48:16 UTC (rev 14434)
@@ -66,29 +66,31 @@
 		RegCloseKey(hkey);
 	}
 
-	MSG msg;
+	if (!sso_ptrs.empty()) {
+		MSG msg;
 
-	while(_alive) {
-		if (MsgWaitForMultipleObjects(1, &_evtFinish, FALSE, INFINITE, QS_ALLINPUT) == WAIT_OBJECT_0+0)
-			break;	// _evtFinish has been set.
-
 		while(_alive) {
-			if (!PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
-				break;
+			if (MsgWaitForMultipleObjects(1, &_evtFinish, FALSE, INFINITE, QS_ALLINPUT) == WAIT_OBJECT_0+0)
+				break;	// _evtFinish has been set.
 
-			if (msg.message == WM_QUIT)
-				break;
+			while(_alive) {
+				if (!PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+					break;
 
-			TranslateMessage(&msg);
-			DispatchMessage(&msg);
+				if (msg.message == WM_QUIT)
+					break;
+
+				TranslateMessage(&msg);
+				DispatchMessage(&msg);
+			}
 		}
-	}
 
-	 // shutdown all running Shell Service Objects
-	for(SSOVector::iterator it=sso_ptrs.begin(); it!=sso_ptrs.end(); ++it) {
-		SIfacePtr<IOleCommandTarget>* sso_ptr = *it;
-		(*sso_ptr)->Exec(&CGID_ShellServiceObject, OLECMDID_SAVE, OLECMDEXECOPT_DODEFAULT, NULL, NULL);
-		delete sso_ptr;
+		 // shutdown all running Shell Service Objects
+		for(SSOVector::iterator it=sso_ptrs.begin(); it!=sso_ptrs.end(); ++it) {
+			SIfacePtr<IOleCommandTarget>* sso_ptr = *it;
+			(*sso_ptr)->Exec(&CGID_ShellServiceObject, OLECMDID_SAVE, OLECMDEXECOPT_DODEFAULT, NULL, NULL);
+			delete sso_ptr;
+		}
 	}
 
 	return 0;