summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Ioffe <ioffe@google.com>2020-09-30 21:39:24 +0100
committerNikita Ioffe <ioffe@google.com>2020-09-30 21:39:24 +0100
commit7758851a40f689d9acf9e0c0cdb60c3380cbd9f5 (patch)
tree4f03dab88c0b37318187540944a7e9a158a30ab7
parent06aefcc4cb632bd982640309f551359199527782 (diff)
downloadplatform_system_apex-7758851a40f689d9acf9e0c0cdb60c3380cbd9f5.tar.gz
platform_system_apex-7758851a40f689d9acf9e0c0cdb60c3380cbd9f5.tar.bz2
platform_system_apex-7758851a40f689d9acf9e0c0cdb60c3380cbd9f5.zip
Make ApexdLifecycle a true singletone
Removing copy&move c-tors ensures that callers won't accidentally create a local copy of a singletone. Test: device boots Test: atest ApexTestCases Change-Id: Ib93566de8c587bb465588551d04cc5c7ebf9e9c7
-rw-r--r--apexd/apexd_lifecycle.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/apexd/apexd_lifecycle.h b/apexd/apexd_lifecycle.h
index bdd3863a..bab0a05e 100644
--- a/apexd/apexd_lifecycle.h
+++ b/apexd/apexd_lifecycle.h
@@ -27,6 +27,11 @@ class ApexdLifecycle {
ApexdLifecycle(){};
std::atomic<bool> boot_completed_;
+ // Non-copyable && non-moveable.
+ ApexdLifecycle(const ApexdLifecycle&) = delete;
+ ApexdLifecycle& operator=(const ApexdLifecycle&) = delete;
+ ApexdLifecycle& operator=(ApexdLifecycle&&) = delete;
+
public:
static ApexdLifecycle& getInstance() {
static ApexdLifecycle instance;
@@ -40,4 +45,4 @@ class ApexdLifecycle {
} // namespace apex
} // namespace android
-#endif // ANDROID_APEXD_APEXD_LIFECYCLE_H \ No newline at end of file
+#endif // ANDROID_APEXD_APEXD_LIFECYCLE_H