Poco

template < class M >

class ScopedLockWithUnlock

Library: Foundation
Package: Threading
Header: Poco/ScopedLock.h

Description

A class that simplifies thread synchronization with a mutex. The constructor accepts a Mutex (and optionally a timeout value in milliseconds) and locks it. The destructor unlocks the mutex. The unlock() member function allows for manual unlocking of the mutex.

Member Summary

Member Functions: lock, operator =, ownsLock, tryLock, unlock

Constructors

ScopedLockWithUnlock

ScopedLockWithUnlock() = delete;

ScopedLockWithUnlock inline

explicit ScopedLockWithUnlock(
    M & mutex
);

ScopedLockWithUnlock

ScopedLockWithUnlock(
    const ScopedLockWithUnlock & param374
) = delete;

ScopedLockWithUnlock inline

ScopedLockWithUnlock(
    M & mutex,
    long milliseconds
);

ScopedLockWithUnlock inline

ScopedLockWithUnlock(
    M & mutex,
    std::adopt_lock_t
);

Construct and assume already locked

ScopedLockWithUnlock inline

ScopedLockWithUnlock(
    M & mutex,
    std::try_to_lock_t
);

Construct and try to lock

ScopedLockWithUnlock inline

ScopedLockWithUnlock(
    M & mutex,
    std::defer_lock_t
);

Construct but don't lock

Destructor

~ScopedLockWithUnlock inline

~ScopedLockWithUnlock();

Member Functions

lock inline

void lock();

operator =

ScopedLockWithUnlock & operator = (
    const ScopedLockWithUnlock & param375
) = delete;

ownsLock inline

bool ownsLock() const;

tryLock inline

bool tryLock();

unlock inline

void unlock();