Public Types | Public Member Functions
AtProfiledLockable< Mutex > Class Template Reference

Wrapper for Lockable type mutexes, such as std::mutex and std::recursive_mutex. More...

#include <ai_critsec.h>

Public Types

using mutex_type = Mutex
 
using native_handle_type = typename Mutex::native_handle_type
 

Public Member Functions

void lock ()
 
bool try_lock ()
 
void unlock ()
 
native_handle_type native_handle ()
 
const mutex_type & get () const
 
mutex_type & get ()
 

Detailed Description

template<class Mutex>
class AtProfiledLockable< Mutex >

Wrapper for Lockable type mutexes, such as std::mutex and std::recursive_mutex.

Use this so that the arnold profiler can keep track of of the time spent blocked waiting to lock. For instance, you can replace the following C++11/14 code:

std::mutex my_mutex;
std::lock_guard<std::mutex> my_guard(my_mutex);

with:

std::lock_guard<AtProfiledLockable<std::mutex>> my_guard(my_mutex);
Wrapper for Lockable type mutexes, such as std::mutex and std::recursive_mutex.
Definition: ai_critsec.h:44

As a convenience, the AtMutex and AtRecursiveMutex type aliases can be used so that instead one would write:

AtMutex my_mutex;
std::lock_guard<AtMutex> my_guard(my_mutex);

Note that starting with C++17 this can be further simplified to:

AtMutex my_mutex;
std::lock_guard my_guard(my_mutex);

The documentation for this class was generated from the following file:

© 2022 Autodesk, Inc. · All rights reserved · www.arnoldrenderer.com