Guard prof_active reset by opt_prof

Set `prof_active` to read-only when `opt_prof` is turned off.
This commit is contained in:
Yinan Zhang
2019-08-27 14:42:14 -07:00
parent 1df9dd3515
commit beb7c16e94
4 changed files with 49 additions and 2 deletions

View File

@@ -788,6 +788,7 @@ bool
prof_active_get(tsdn_t *tsdn) {
bool prof_active_current;
prof_active_assert();
malloc_mutex_lock(tsdn, &prof_active_mtx);
prof_active_current = prof_active;
malloc_mutex_unlock(tsdn, &prof_active_mtx);
@@ -798,10 +799,12 @@ bool
prof_active_set(tsdn_t *tsdn, bool active) {
bool prof_active_old;
prof_active_assert();
malloc_mutex_lock(tsdn, &prof_active_mtx);
prof_active_old = prof_active;
prof_active = active;
malloc_mutex_unlock(tsdn, &prof_active_mtx);
prof_active_assert();
return prof_active_old;
}