Have setMinSchedulerPolicy clean itself up.
This cleans up any other entries in the map whenever a new
one is added. This API is expected to be called extremely
infrequently, so the current solution will only allow a single
wp object to be leaked.
Fixes: 111192774
Test: boot
Change-Id: I740a596978440786dc06c977ba37bf3b1f9017d5
diff --git a/transport/include/hidl/ConcurrentMap.h b/transport/include/hidl/ConcurrentMap.h
index 4066869..54c1a32 100644
--- a/transport/include/hidl/ConcurrentMap.h
+++ b/transport/include/hidl/ConcurrentMap.h
@@ -76,6 +76,14 @@
return iter->second;
}
+ size_type eraseLocked(const K& k) { return mMap.erase(k); }
+
+ // the concurrent map must be locked in order to iterate over it
+ iterator begin() { return mMap.begin(); }
+ iterator end() { return mMap.end(); }
+ const_iterator begin() const { return mMap.begin(); }
+ const_iterator end() const { return mMap.end(); }
+
private:
mutable std::mutex mMutex;
std::map<K, V> mMap;