HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Static Public Member Functions
hi::v1::dead_lock_detector Class Reference

#include <hikogui/concurrency/dead_lock_detector.hpp>

Static Public Member Functions

static void * lock (void *object) noexcept
 Lock an object on this thread.
 
static bool unlock (void *object) noexcept
 Unlock an object on this thread.
 
static void remove_object (void *object) noexcept
 Remove the object from the detection.
 
static void clear_stack () noexcept
 Clear the stack.
 
static void clear_graph () noexcept
 Clear the graph.
 

Detailed Description

Dead lock detector.

The dead lock detector should not be used before and after main(). By using hi::unfair_mutex_impl<false> you can get a mutex without a dead lock detector.

In the future when MSVC allows constinit thread_local variables we can change the implementation to allow the dead lock detector before main().

Member Function Documentation

◆ clear_graph()

static void hi::v1::dead_lock_detector::clear_graph ( )
staticnoexcept

Clear the graph.

Is used in unit-tests.

◆ clear_stack()

static void hi::v1::dead_lock_detector::clear_stack ( )
staticnoexcept

Clear the stack.

Is used in unit-tests.

◆ lock()

static void * hi::v1::dead_lock_detector::lock ( void * object)
staticnoexcept

Lock an object on this thread.

Parameters
objectThe object that is being locked.
Returns
nullptr on success, object if the mutex was already locked, a pointer to another mutex if potential dead-lock is found.

◆ remove_object()

static void hi::v1::dead_lock_detector::remove_object ( void * object)
staticnoexcept

Remove the object from the detection.

This function is needed when there are mutex-like objects that are dynamically de-allocated.

Parameters
objectThe object to remove from the lock order graph.

◆ unlock()

static bool hi::v1::dead_lock_detector::unlock ( void * object)
staticnoexcept

Unlock an object on this thread.

Parameters
objectThe object that is being locked.
Returns
true on success, false on failure.

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