mirror of
https://github.com/monero-project/monero.git
synced 2025-05-06 13:35:04 -04:00
common: add a class to safely wrap mlock/munlock
This class will allow mlocking small objects, of which there may be several per page. It adds refcounting so pages are only munlocked when the last object on that page munlocks.
This commit is contained in:
parent
e9ffa91257
commit
70271fa788
6 changed files with 464 additions and 1 deletions
|
@ -46,6 +46,7 @@
|
|||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include "hex.h"
|
||||
#include "memwipe.h"
|
||||
#include "mlocker.h"
|
||||
#include "span.h"
|
||||
#include "warnings.h"
|
||||
|
||||
|
@ -358,6 +359,12 @@ POP_WARNINGS
|
|||
return hex_to_pod(hex_str, unwrap(s));
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
template<class t_pod_type>
|
||||
bool hex_to_pod(const std::string& hex_str, epee::mlocked<t_pod_type>& s)
|
||||
{
|
||||
return hex_to_pod(hex_str, unwrap(s));
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool validate_hex(uint64_t length, const std::string& str);
|
||||
//----------------------------------------------------------------------------
|
||||
inline std::string get_extension(const std::string& str)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue