aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-11-20 15:24:16 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-11-20 15:26:00 +0000
commit23829ebb09cfa016044f6e5a0b361de1e04705ad (patch)
treecdddba455d6635e715220e9c3f0e396935cb099c /contrib/epee
parentMerge pull request #4781 (diff)
downloadmonero-23829ebb09cfa016044f6e5a0b361de1e04705ad.tar.xz
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.
Diffstat (limited to 'contrib/epee')
-rw-r--r--contrib/epee/src/mlocker.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/contrib/epee/src/mlocker.cpp b/contrib/epee/src/mlocker.cpp
index c3262e8f4..7ac79bd9a 100644
--- a/contrib/epee/src/mlocker.cpp
+++ b/contrib/epee/src/mlocker.cpp
@@ -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()