Browse Source

lock this

synchronous
Volker Birk 5 years ago
parent
commit
cf0d6b3b64
  1. 1
      passphrase_cache.cc
  2. 1
      passphrase_cache.hh

1
passphrase_cache.cc

@ -48,6 +48,7 @@ namespace pEp {
const char *PassphraseCache::add_stored(const std::string& passphrase) const char *PassphraseCache::add_stored(const std::string& passphrase)
{ {
std::lock_guard<std::mutex> lock(_shared_mtx);
_stored = passphrase; _stored = passphrase;
return _stored.c_str(); return _stored.c_str();
} }

1
passphrase_cache.hh

@ -26,6 +26,7 @@ namespace pEp {
cache _cache; cache _cache;
std::string _stored; std::string _stored;
std::mutex _mtx; std::mutex _mtx;
std::mutex _shared_mtx;
size_t _max_size; size_t _max_size;
duration _timeout; duration _timeout;

Loading…
Cancel
Save