Allow mutexes to take a lock ordering enum at construction.

This lets us specify whether and how mutexes of the same rank are allowed to be
acquired.  Currently, we only allow two polices (only a single mutex at a given
rank at a time, and mutexes acquired in ascending order), but we can plausibly
allow more (e.g. the "release uncontended mutexes before blocking").
This commit is contained in:
David Goldblatt
2017-05-15 15:38:15 -07:00
committed by David Goldblatt
parent 6e62c62862
commit 26c792e61a
12 changed files with 75 additions and 30 deletions

View File

@@ -18,7 +18,8 @@ rtree_new(rtree_t *rtree, bool zeroed) {
assert(zeroed);
#endif
if (malloc_mutex_init(&rtree->init_lock, "rtree", WITNESS_RANK_RTREE)) {
if (malloc_mutex_init(&rtree->init_lock, "rtree", WITNESS_RANK_RTREE,
malloc_mutex_rank_exclusive)) {
return true;
}