mlocker: don't throw from lock/unlock

This prevents exceptions from showing up in various awkward
places such as dtors, since the only exception that can be
thrown is a lock failure, and nothing handles a lock failure
anyway.
This commit is contained in:
moneromooo-monero 2018-11-20 15:24:16 +00:00
parent 84dd674cd0
commit 23829ebb09
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 8 additions and 0 deletions

View File

@ -113,6 +113,8 @@ namespace epee
void mlocker::lock(void *ptr, size_t len)
{
TRY_ENTRY();
size_t page_size = get_page_size();
if (page_size == 0)
return;
@ -123,10 +125,14 @@ namespace epee
for (size_t page = first; page <= last; ++page)
lock_page(page);
++num_locked_objects;
CATCH_ENTRY_L1("mlocker::lock", void());
}
void mlocker::unlock(void *ptr, size_t len)
{
TRY_ENTRY();
size_t page_size = get_page_size();
if (page_size == 0)
return;
@ -136,6 +142,8 @@ namespace epee
for (size_t page = first; page <= last; ++page)
unlock_page(page);
--num_locked_objects;
CATCH_ENTRY_L1("mlocker::lock", void());
}
size_t mlocker::get_num_locked_pages()