Add polymorphism support to Ref
This commit is contained in:
@@ -444,7 +444,7 @@ struct Metric {
|
||||
}
|
||||
|
||||
static auto &get_collectors() {
|
||||
using CollectorRegistry = std::vector<std::shared_ptr<Collector>>;
|
||||
using CollectorRegistry = std::vector<Ref<Collector>>;
|
||||
static CollectorRegistry *collectors = new CollectorRegistry();
|
||||
return *collectors;
|
||||
}
|
||||
@@ -1803,7 +1803,7 @@ void reset_metrics_for_testing() {
|
||||
// when threads exit naturally
|
||||
}
|
||||
|
||||
void register_collector(std::shared_ptr<Collector> collector) {
|
||||
void register_collector(Ref<Collector> collector) {
|
||||
std::unique_lock<std::mutex> _{Metric::mutex};
|
||||
++Metric::registration_version;
|
||||
Metric::get_collectors().push_back(std::move(collector));
|
||||
|
||||
Reference in New Issue
Block a user