Library became almost thread-safe

Library became thread-safe with the exception of `getBookById()`
and `getBookByPath()` methods - thread safety in those accessors is
rendered meaningless by their return type (they return a reference
to a book which can be removed any time later by another thread).
This commit is contained in:
Veloman Yunkan
2021-11-28 18:50:07 +04:00
parent c2927ce6f7
commit 02b9e32d18
2 changed files with 42 additions and 3 deletions

View File

@ -215,8 +215,11 @@ class Library : private LibraryBase
*/
bool removeBookmark(const std::string& zimId, const std::string& url);
// XXX: This is a non-thread-safe operation
const Book& getBookById(const std::string& id) const;
// XXX: This is a non-thread-safe operation
const Book& getBookByPath(const std::string& path) const;
std::shared_ptr<Reader> getReaderById(const std::string& id);
std::shared_ptr<zim::Archive> getArchiveById(const std::string& id);