diff options
author | Adam <Adam@anope.org> | 2012-05-08 18:04:49 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-05-08 18:04:49 -0400 |
commit | 820e4edc2bfc132a526e5c6db51d94f10ddc4542 (patch) | |
tree | a6daebbc9958f312475699a061a99ee533cd0858 /src/serialize.cpp | |
parent | 25586f32467334f0366ce0b8bfe16e2d5e005851 (diff) |
Fixed some 100% cpu bugs with the new SQL stuff, and fixed sqlite+db_sql_live
Diffstat (limited to 'src/serialize.cpp')
-rw-r--r-- | src/serialize.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/serialize.cpp b/src/serialize.cpp index 9ff3fca1d..7bcf12283 100644 --- a/src/serialize.cpp +++ b/src/serialize.cpp @@ -70,7 +70,7 @@ unsigned stringstream::getMax() const return this->_max; } -Serializable::Serializable() : id(0) +Serializable::Serializable() : last_commit_time(0), id(0) { if (serializable_items == NULL) serializable_items = new std::list<Serializable *>(); @@ -82,7 +82,7 @@ Serializable::Serializable() : id(0) FOREACH_MOD(I_OnSerializableConstruct, OnSerializableConstruct(this)); } -Serializable::Serializable(const Serializable &) : id(0) +Serializable::Serializable(const Serializable &) : last_commit_time(0), id(0) { serializable_items->push_back(this); this->s_iter = serializable_items->end(); @@ -126,6 +126,16 @@ void Serializable::UpdateCache() this->last_commit = this->serialize(); } +bool Serializable::IsTSCached() +{ + return this->last_commit_time == Anope::CurTime; +} + +void Serializable::UpdateTS() +{ + this->last_commit_time = Anope::CurTime; +} + const std::list<Serializable *> &Serializable::GetItems() { return *serializable_items; |