class ugcs::vsm::Request_container::Request_waiter::Locker

Overview

Helper class for RAII-based locking and notifying Request_waiter objects. More…

#include <request_container.h>

class Locker
{
public:
    // construction

    Locker(Request_waiter::Ptr waiter, bool want_notify = false);
    Locker(const Locker&);
    Locker(Locker&&);

    // methods

    void Lock();
    void Unlock();
    bool Want_notify() const;
    bool Is_same_waiter(const Request_waiter::Ptr&) const;
};

Detailed Documentation

Helper class for RAII-based locking and notifying Request_waiter objects.

Obtained via Request_waiter::Lock and Request_waiter::Lock_notify methods.

Construction

Locker(Request_waiter::Ptr waiter, bool want_notify = false)

Construct locker object.

Parameters:

waiter

Associated waiter object.

want_notify

Automatically call waiter Request_waiter::Notify() method when the lock is released.

Locker(const Locker&)

Disable copying.

Locker(Locker&&)

Enable moving.

Methods

void Lock()

Lock the waiter explicitly.

Parameters:

Invalid_op_exception

if already locked.

void Unlock()

Unlock the waiter explicitly.

Parameters:

Invalid_op_exception

if already unlocked.

bool Want_notify() const

Is locker wants a notify.

bool Is_same_waiter(const Request_waiter::Ptr&) const

Check if locker is bound to this waiter.