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.
pull/130/head
moneromooo-monero 6 years ago
parent 84dd674cd0
commit 23829ebb09
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3

@ -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()

Loading…
Cancel
Save