poco icon indicating copy to clipboard operation
poco copied to clipboard

enh(ScopedLockWithUnlock): make it more alike std::unique_lock

Open siren186 opened this issue 6 months ago • 0 comments

void test_std()
{
    std::mutex m;
    std::unique_lock<std::mutex> guard(m);
    guard.unlock(); // OK
    guard.lock(); // OK
}

void test_poco()
{
    Poco::Mutex m;
    Poco::ScopedLockWithUnlock<Poco::Mutex> guard(m);
    guard.unlock(); // OK
    guard.lock(); // Failed !!!
}

This PR is to make Poco::ScopedLockWithUnlock can lock/unlock for many time. Just same like std::unique_lock do.

siren186 avatar Aug 22 '24 11:08 siren186