summaryrefslogtreecommitdiff
path: root/src/CommonAPI/MainLoopContext.h
diff options
context:
space:
mode:
authorPhilip Rauwolf <rauwolf@itestra.de>2013-06-24 14:30:28 +0200
committerPhilip Rauwolf <rauwolf@itestra.de>2013-06-24 14:30:28 +0200
commite85fa0d2bd06ded7ee460e818994817aca80d2ef (patch)
tree3a663adfd3bdeb8128fd5eb03c14206f51c696cd /src/CommonAPI/MainLoopContext.h
parent74b90aeece8cc8dd7f6e3fb275851e80b8754d7e (diff)
downloadgenivi-common-api-runtime-e85fa0d2bd06ded7ee460e818994817aca80d2ef.tar.gz
Added check on the mainloop context being initialized before used
Diffstat (limited to 'src/CommonAPI/MainLoopContext.h')
-rw-r--r--src/CommonAPI/MainLoopContext.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/CommonAPI/MainLoopContext.h b/src/CommonAPI/MainLoopContext.h
index 0d87442..c651532 100644
--- a/src/CommonAPI/MainLoopContext.h
+++ b/src/CommonAPI/MainLoopContext.h
@@ -314,6 +314,16 @@ class MainLoopContext {
}
}
+ /**
+ * \brief Will return true if at least one subscribe for DispatchSources or Watches has been called.
+ *
+ * This function will be used to prevent creation of a factory if a mainloop context is given, but
+ * no listeners have been registered. This is done in order to ensure correct use of the mainloop context.
+ */
+ inline bool isInitialized() {
+ return dispatchSourceListeners_.size() > 0 || watchListeners_.size() > 0;
+ }
+
private:
DispatchSourceListenerList dispatchSourceListeners_;
WatchListenerList watchListeners_;