class EE::System::ConditionalLock

Overview

#include <lock.hpp>

class ConditionalLock: private EE::NonCopyable {
public:
    // construction

    ConditionalLock(bool condition, Mutex* mutex);
    ~ConditionalLock();
};

Detailed Documentation

Construction

ConditionalLock(bool condition, Mutex* mutex)

Construct the lock with a target mutex The mutex passed to Lock is automatically locked.

Parameters:

condition

Only if condition is true the mutex will be locked/unlocked.

mutex

Mutex to lock

~ConditionalLock()

Destructor The destructor of Lock automatically unlocks its mutex.