Skip to content

Pylon::AutoLock#

A scoped lock class to acquire and release a CLock upon creation and destruction. More…

#include <pylon/TypeMappings.h>

Detailed Description#

class Pylon::AutoLock;

A scoped lock class to acquire and release a CLock upon creation and destruction.

See: CLock

Use this class to created scoped lock. To acquire the lock just create a CAutoLock object. When the object will be destroyed it will automatically release the lock.

int SampleFunction(Pylon::CLock & lock)
{
    // acquire lock
    Pylon::AutoLock scopedLock(lock);

    // perform operation requiring lock to be held here

    return 1;

    // lock will be released automatically when scopedLock goes out of scope and is destroyed
}