[icinga-checkins] icinga.org: icinga2/master: Make Application::ProcessEvents() static.

git at icinga.org git at icinga.org
Wed Feb 13 07:35:25 CET 2013


Module: icinga2
Branch: master
Commit: 2893134940de69f6f9ecebb6216fef0965b0791b
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=2893134940de69f6f9ecebb6216fef0965b0791b

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Wed Feb 13 07:25:36 2013 +0100

Make Application::ProcessEvents() static.

---

 lib/base/application.cpp |    2 +-
 lib/base/application.h   |    2 +-
 lib/base/utility.cpp     |   14 ++------------
 3 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/lib/base/application.cpp b/lib/base/application.cpp
index 5af93ab..7fdcfa2 100644
--- a/lib/base/application.cpp
+++ b/lib/base/application.cpp
@@ -91,7 +91,7 @@ Application::Ptr Application::GetInstance(void)
  *
  * @returns false if we're shutting down, true otherwise.
  */
-bool Application::ProcessEvents(void) const
+bool Application::ProcessEvents(void)
 {
 	Object::ClearHeldObjects();
 
diff --git a/lib/base/application.h b/lib/base/application.h
index 3ba1af3..fb92f50 100644
--- a/lib/base/application.h
+++ b/lib/base/application.h
@@ -76,7 +76,7 @@ public:
 	static String GetPkgDataDir(void);
 	static void SetPkgDataDir(const String& path);
 
-	bool ProcessEvents(void) const;
+	static bool ProcessEvents(void);
 
 protected:
 	void RunEventLoop(void) const;
diff --git a/lib/base/utility.cpp b/lib/base/utility.cpp
index f22f611..e8b9de8 100644
--- a/lib/base/utility.cpp
+++ b/lib/base/utility.cpp
@@ -522,17 +522,7 @@ bool Utility::Glob(const String& pathSpec, const function<void (const String&)>&
  */
 void Utility::WaitUntil(const function<bool (void)>& predicate)
 {
-	while (!predicate()) {
-		Application::Ptr instance = Application::GetInstance();
-
-		/* Waiting for a predicate requires an application instance.
-		 * This means we cannot do certain asynchronous things
-		 * (like spawning a process) until the application instance
-		 * has been initialized. */
-		if (!instance)
-			BOOST_THROW_EXCEPTION(runtime_error("Waiting for predicate failed: Application instance is not initialized."));
-
-		instance->ProcessEvents();
-	}
+	while (!predicate())
+		Application::ProcessEvents();
 }
 





More information about the icinga-checkins mailing list