Unbreak build on VS2012.

This commit is contained in:
Peter Johnson
2015-12-28 19:27:05 -08:00
parent fef8f933d9
commit 2aaaed34f9

View File

@@ -71,7 +71,10 @@ Notifier::Notifier() {
Notifier::~Notifier() { s_destroyed = true; }
void Notifier::Start() { m_owner.Start(new Thread(m_on_start, m_on_exit)); }
void Notifier::Start() {
auto thr = m_owner.GetThread();
if (!thr) m_owner.Start(new Thread(m_on_start, m_on_exit));
}
void Notifier::Stop() { m_owner.Stop(); }
@@ -165,11 +168,8 @@ done:
unsigned int Notifier::AddEntryListener(StringRef prefix,
EntryListenerCallback callback,
unsigned int flags) {
Start();
auto thr = m_owner.GetThread();
if (!thr) {
Start();
thr = m_owner.GetThread();
}
unsigned int uid = thr->m_entry_listeners.size();
thr->m_entry_listeners.emplace_back(prefix, callback, flags);
if ((flags & NT_NOTIFY_LOCAL) != 0) m_local_notifiers = true;
@@ -197,11 +197,8 @@ void Notifier::NotifyEntry(StringRef name, std::shared_ptr<Value> value,
unsigned int Notifier::AddConnectionListener(
ConnectionListenerCallback callback) {
Start();
auto thr = m_owner.GetThread();
if (!thr) {
Start();
thr = m_owner.GetThread();
}
unsigned int uid = thr->m_entry_listeners.size();
thr->m_conn_listeners.emplace_back(callback);
return uid + 1;