diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-04-05 22:57:45 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-04-05 22:57:45 +0000 |
commit | 0cd6f180701a35abe5da0f4b0272b3047c03e330 (patch) | |
tree | b125489be5670eb775dd43f96236744eaedf9ef3 /plugins/Dbx_kyoto/src/kyotocabinet/kctextdb.h | |
parent | 56e1f721234e3f6d1ef3eb8cff2dc3f322c2b831 (diff) |
various speed optimizations
git-svn-id: http://svn.miranda-ng.org/main/trunk@12621 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_kyoto/src/kyotocabinet/kctextdb.h')
-rw-r--r-- | plugins/Dbx_kyoto/src/kyotocabinet/kctextdb.h | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/plugins/Dbx_kyoto/src/kyotocabinet/kctextdb.h b/plugins/Dbx_kyoto/src/kyotocabinet/kctextdb.h index 324af3d8f1..d707059fe1 100644 --- a/plugins/Dbx_kyoto/src/kyotocabinet/kctextdb.h +++ b/plugins/Dbx_kyoto/src/kyotocabinet/kctextdb.h @@ -63,7 +63,7 @@ class TextDB : public BasicDB { */ explicit Cursor(TextDB* db) : db_(db), off_(INT64MAX), end_(0), queue_(), line_() { _assert_(db); - ScopedRWLock lock(&db_->mlock_, true); + // ScopedRWLock lock(&db_->mlock_, true); db_->curs_.push_back(this); } /** @@ -72,7 +72,7 @@ class TextDB : public BasicDB { virtual ~Cursor() { _assert_(true); if (!db_) return; - ScopedRWLock lock(&db_->mlock_, true); + // ScopedRWLock lock(&db_->mlock_, true); db_->curs_.remove(this); } /** @@ -86,7 +86,7 @@ class TextDB : public BasicDB { */ bool accept(Visitor* visitor, bool writable = true, bool step = false) { _assert_(visitor); - ScopedRWLock lock(&db_->mlock_, false); + // ScopedRWLock lock(&db_->mlock_, false); if (db_->omode_ == 0) { db_->set_error(_KCCODELINE_, Error::INVALID, "not opened"); return false; @@ -105,7 +105,7 @@ class TextDB : public BasicDB { */ bool jump() { _assert_(true); - ScopedRWLock lock(&db_->mlock_, false); + // ScopedRWLock lock(&db_->mlock_, false); if (db_->omode_ == 0) { db_->set_error(_KCCODELINE_, Error::INVALID, "not opened"); return false; @@ -128,7 +128,7 @@ class TextDB : public BasicDB { */ bool jump(const char* kbuf, size_t ksiz) { _assert_(kbuf && ksiz <= MEMMAXSIZ); - ScopedRWLock lock(&db_->mlock_, true); + // ScopedRWLock lock(&db_->mlock_, true); if (db_->omode_ == 0) { db_->set_error(_KCCODELINE_, Error::INVALID, "not opened"); return false; @@ -157,7 +157,7 @@ class TextDB : public BasicDB { */ bool jump_back() { _assert_(true); - ScopedRWLock lock(&db_->mlock_, true); + // ScopedRWLock lock(&db_->mlock_, true); if (db_->omode_ == 0) { db_->set_error(_KCCODELINE_, Error::INVALID, "not opened"); return false; @@ -171,7 +171,7 @@ class TextDB : public BasicDB { */ bool jump_back(const char* kbuf, size_t ksiz) { _assert_(kbuf && ksiz <= MEMMAXSIZ); - ScopedRWLock lock(&db_->mlock_, true); + // ScopedRWLock lock(&db_->mlock_, true); if (db_->omode_ == 0) { db_->set_error(_KCCODELINE_, Error::INVALID, "not opened"); return false; @@ -193,7 +193,7 @@ class TextDB : public BasicDB { */ bool step() { _assert_(true); - ScopedRWLock lock(&db_->mlock_, false); + // ScopedRWLock lock(&db_->mlock_, false); if (db_->omode_ == 0) { db_->set_error(_KCCODELINE_, Error::INVALID, "not opened"); return false; @@ -212,7 +212,7 @@ class TextDB : public BasicDB { */ bool step_back() { _assert_(true); - ScopedRWLock lock(&db_->mlock_, true); + // ScopedRWLock lock(&db_->mlock_, true); if (db_->omode_ == 0) { db_->set_error(_KCCODELINE_, Error::INVALID, "not opened"); return false; @@ -359,7 +359,7 @@ class TextDB : public BasicDB { */ bool accept(const char* kbuf, size_t ksiz, Visitor* visitor, bool writable = true) { _assert_(kbuf && ksiz <= MEMMAXSIZ && visitor); - ScopedRWLock lock(&mlock_, false); + // ScopedRWLock lock(&mlock_, false); if (omode_ == 0) { set_error(_KCCODELINE_, Error::INVALID, "not opened"); return false; @@ -385,7 +385,7 @@ class TextDB : public BasicDB { bool accept_bulk(const std::vector<std::string>& keys, Visitor* visitor, bool writable = true) { _assert_(visitor); - ScopedRWLock lock(&mlock_, true); + // ScopedRWLock lock(&mlock_, true); if (omode_ == 0) { set_error(_KCCODELINE_, Error::INVALID, "not opened"); return false; @@ -415,7 +415,7 @@ class TextDB : public BasicDB { */ bool iterate(Visitor *visitor, bool writable = true, ProgressChecker* checker = NULL) { _assert_(visitor); - ScopedRWLock lock(&mlock_, true); + // ScopedRWLock lock(&mlock_, true); if (omode_ == 0) { set_error(_KCCODELINE_, Error::INVALID, "not opened"); return false; @@ -442,7 +442,7 @@ class TextDB : public BasicDB { */ bool scan_parallel(Visitor *visitor, size_t thnum, ProgressChecker* checker = NULL) { _assert_(visitor && thnum <= MEMMAXSIZ); - ScopedRWLock lock(&mlock_, false); + // ScopedRWLock lock(&mlock_, false); if (omode_ == 0) { set_error(_KCCODELINE_, Error::INVALID, "not opened"); return false; @@ -503,7 +503,7 @@ class TextDB : public BasicDB { */ bool open(const std::string& path, uint32_t mode = OWRITER | OCREATE) { _assert_(true); - ScopedRWLock lock(&mlock_, true); + // ScopedRWLock lock(&mlock_, true); if (omode_ != 0) { set_error(_KCCODELINE_, Error::INVALID, "already opened"); return false; @@ -550,7 +550,7 @@ class TextDB : public BasicDB { */ bool close() { _assert_(true); - ScopedRWLock lock(&mlock_, true); + // ScopedRWLock lock(&mlock_, true); if (omode_ == 0) { set_error(_KCCODELINE_, Error::INVALID, "not opened"); return false; @@ -581,7 +581,7 @@ class TextDB : public BasicDB { bool synchronize(bool hard = false, FileProcessor* proc = NULL, ProgressChecker* checker = NULL) { _assert_(true); - ScopedRWLock lock(&mlock_, false); + // ScopedRWLock lock(&mlock_, false); if (omode_ == 0) { set_error(_KCCODELINE_, Error::INVALID, "not opened"); return false; @@ -602,7 +602,7 @@ class TextDB : public BasicDB { */ bool occupy(bool writable = true, FileProcessor* proc = NULL) { _assert_(true); - ScopedRWLock lock(&mlock_, writable); + // ScopedRWLock lock(&mlock_, writable); bool err = false; if (proc && !proc->process(path_, -1, file_.size())) { set_error(_KCCODELINE_, Error::LOGIC, "processing failed"); @@ -619,7 +619,7 @@ class TextDB : public BasicDB { */ bool begin_transaction(bool hard = false) { _assert_(true); - ScopedRWLock lock(&mlock_, true); + // ScopedRWLock lock(&mlock_, true); if (omode_ == 0) { set_error(_KCCODELINE_, Error::INVALID, "not opened"); return false; @@ -635,7 +635,7 @@ class TextDB : public BasicDB { */ bool begin_transaction_try(bool hard = false) { _assert_(true); - ScopedRWLock lock(&mlock_, true); + // ScopedRWLock lock(&mlock_, true); if (omode_ == 0) { set_error(_KCCODELINE_, Error::INVALID, "not opened"); return false; @@ -650,7 +650,7 @@ class TextDB : public BasicDB { */ bool end_transaction(bool commit = true) { _assert_(true); - ScopedRWLock lock(&mlock_, true); + // ScopedRWLock lock(&mlock_, true); if (omode_ == 0) { set_error(_KCCODELINE_, Error::INVALID, "not opened"); return false; @@ -664,7 +664,7 @@ class TextDB : public BasicDB { */ bool clear() { _assert_(true); - ScopedRWLock lock(&mlock_, true); + // ScopedRWLock lock(&mlock_, true); if (omode_ == 0) { set_error(_KCCODELINE_, Error::INVALID, "not opened"); return false; @@ -691,7 +691,7 @@ class TextDB : public BasicDB { */ int64_t count() { _assert_(true); - ScopedRWLock lock(&mlock_, false); + // ScopedRWLock lock(&mlock_, false); if (omode_ == 0) { set_error(_KCCODELINE_, Error::INVALID, "not opened"); return -1; @@ -705,7 +705,7 @@ class TextDB : public BasicDB { */ int64_t size() { _assert_(true); - ScopedRWLock lock(&mlock_, false); + // ScopedRWLock lock(&mlock_, false); if (omode_ == 0) { set_error(_KCCODELINE_, Error::INVALID, "not opened"); return -1; @@ -727,7 +727,7 @@ class TextDB : public BasicDB { */ bool status(std::map<std::string, std::string>* strmap) { _assert_(strmap); - ScopedRWLock lock(&mlock_, true); + // ScopedRWLock lock(&mlock_, true); if (omode_ == 0) { set_error(_KCCODELINE_, Error::INVALID, "not opened"); return false; @@ -760,7 +760,7 @@ class TextDB : public BasicDB { void log(const char* file, int32_t line, const char* func, Logger::Kind kind, const char* message) { _assert_(file && line > 0 && func && message); - ScopedRWLock lock(&mlock_, false); + // ScopedRWLock lock(&mlock_, false); if (!logger_) return; logger_->log(file, line, func, kind, message); } @@ -774,7 +774,7 @@ class TextDB : public BasicDB { */ bool tune_logger(Logger* logger, uint32_t kinds = Logger::WARN | Logger::ERROR) { _assert_(logger); - ScopedRWLock lock(&mlock_, true); + // ScopedRWLock lock(&mlock_, true); if (omode_ != 0) { set_error(_KCCODELINE_, Error::INVALID, "already opened"); return false; @@ -790,7 +790,7 @@ class TextDB : public BasicDB { */ bool tune_meta_trigger(MetaTrigger* trigger) { _assert_(trigger); - ScopedRWLock lock(&mlock_, true); + // ScopedRWLock lock(&mlock_, true); if (omode_ != 0) { set_error(_KCCODELINE_, Error::INVALID, "already opened"); return false; @@ -1215,8 +1215,6 @@ class TextDB : public BasicDB { TextDB(const TextDB&); /** Dummy Operator to forbid the use. */ TextDB& operator =(const TextDB&); - /** The method lock. */ - RWLock mlock_; /** The last happened error. */ TSD<Error> error_; /** The internal logger. */ |