Skip to content

Instantly share code, notes, and snippets.

@BruJu
Created May 14, 2020
Embed
What would you like to do?
template <bool try_lock_return>
class DebugMutex {
#ifdef DEBUG
private: std::mutex _mutex;
public:
void lock() { _mutex.lock(); }
void unlock() { _mutex.unlock(); }
bool try_lock() { return _mutex.try_lock(); }
#else
public:
void lock() {}
void unlock() {}
bool try_lock() { return try_lock_return; }
#endif
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment