Metall  v0.29
A persistent memory allocator for data-centric analytics
metall::utility::mutex Namespace Reference

Namespace for mutex. More...

Functions

template<int num_banks>
std::unique_lock< std::mutex > mutex_lock (const std::size_t index)
 A utility function that returns a mutex lock allocated as a static object. This is an experimental implementation. Example: { // Mutex region const int bank_index = hash(key) % num_banks; auto guard = metall::utility::mutex::mutex_lock<num_banks>(bank_index); // do some mutex work }. More...
 

Detailed Description

Namespace for mutex.

Function Documentation

◆ mutex_lock()

template<int num_banks>
std::unique_lock<std::mutex> metall::utility::mutex::mutex_lock ( const std::size_t  index)
inline

A utility function that returns a mutex lock allocated as a static object. This is an experimental implementation. Example: { // Mutex region const int bank_index = hash(key) % num_banks; auto guard = metall::utility::mutex::mutex_lock<num_banks>(bank_index); // do some mutex work }.