auto wait_result = entry.destroy_baton->timed_wait(
std::chrono::steady_clock::now() + kDestroyWaitTime);
if (!wait_result) {
- LOG(ERROR) << "Singleton of type " << type.name() << " has a living "
+ LOG(ERROR) << "Singleton of type " << type.prettyName() << " has a living "
<< "reference at destroyInstances time; beware! Raw pointer "
<< "is " << entry.instance_ptr << ". It is very likely that "
<< "some other singleton is holding a shared_ptr to it. Make "
#include <folly/Hash.h>
#include <folly/Memory.h>
#include <folly/RWSpinLock.h>
+#include <folly/Demangle.h>
#include <folly/io/async/Request.h>
#include <algorithm>
return *this;
}
- std::string name() const {
- std::string ret = ti_.name();
+ std::string prettyName() const {
+ auto ret = demangle(ti_.name());
if (tag_ti_ != std::type_index(typeid(DefaultTag))) {
ret += "/";
- ret += tag_ti_.name();
+ ret += demangle(tag_ti_.name());
}
- return ret;
+ return ret.toStdString();
}
friend class TypeDescriptorHasher;
auto it = singletons_.find(type);
if (it == singletons_.end()) {
throw std::out_of_range(std::string("non-existent singleton: ") +
- type.name());
+ type.prettyName());
}
return it->second.get();
// it if it was set by current thread anyways.
if (entry->creating_thread == std::this_thread::get_id()) {
throw std::out_of_range(std::string("circular singleton dependency: ") +
- type.name());
+ type.prettyName());
}
std::lock_guard<std::mutex> entry_lock(entry->mutex);