break;
CheckTimeView::iterator it = idx.begin();
- Service::Ptr service = it->lock();
+ Service::Ptr service = *it;
- if (!service) {
+ if (!service->IsRegistered()) {
idx.erase(it);
continue;
}
/**
* @threadsafety Caller must hold the mutex for the service.
*/
- double operator()(const Service::WeakPtr& wservice)
+ double operator()(const Service::Ptr& service)
{
- Service::Ptr service = wservice.lock();
-
- if (!service)
- return 0;
-
return service->GetNextCheck();
}
};
typedef weak_ptr<CheckerComponent> WeakPtr;
typedef multi_index_container<
- Service::WeakPtr,
+ Service::Ptr,
indexed_by<
- ordered_unique<identity<Service::WeakPtr> >,
+ ordered_unique<identity<Service::Ptr> >,
ordered_non_unique<ServiceNextCheckExtractor>
>
> ServiceSet;
signals2::signal<void (const DynamicObject::Ptr&)> DynamicObject::OnFlushObject;
DynamicObject::DynamicObject(const Dictionary::Ptr& serializedObject)
- : m_EventSafe(false), m_ConfigTx(0)
+ : m_EventSafe(false), m_ConfigTx(0), m_Registered(false)
{
RegisterAttribute("__name", Attribute_Config, &m_Name);
RegisterAttribute("__type", Attribute_Config, &m_Type);
return m_Abstract;
}
+bool DynamicObject::IsRegistered(void) const
+{
+ return m_Registered;
+}
+
void DynamicObject::SetSource(const String& value)
{
m_Source = value;
}
void DynamicObject::OnRegistrationCompleted(void)
-{ }
+{
+ ObjectLock olock(this);
+ m_Registered = true;
+}
void DynamicObject::OnAttributeChanged(const String&, const Value&)
{ }
bool IsLocal(void) const;
bool IsAbstract(void) const;
+ bool IsRegistered(void) const;
void SetSource(const String& value);
String GetSource(void) const;
Attribute<String> m_Source;
Attribute<Dictionary::Ptr> m_Methods;
+ bool m_Registered;
bool m_EventSafe;
static double m_CurrentTx;