Opened 13 years ago

Closed 10 years ago

#3567 closed Feature Requests (fixed)

Request for shared_lock_guard

Reported by: Andrey Semashev Owned by: viboes
Milestone: Boost 1.50.0 Component: thread
Version: Boost 1.40.0 Severity: Not Applicable
Keywords: lock_guard Cc: viboes

Description

It would be nice to have a lighter alternative for the shared_lock template, similar to the lock_guard alternative for the unique_lock.

Attachments (1)

3567.path (14.1 KB ) - added by viboes 11 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by viboes, 13 years ago

Something like that?

    template<typename Mutex>
    class shared_lock_guard
    {
    private:
        Mutex& m;

        explicit shared_lock_guard(shared_lock_guard&);
        shared_lock_guard& operator=(shared_lock_guard&);
    public:
        explicit shared_lock_guard(Mutex& m_):
            m(m_)
        {
            m.lock_shared();
        }
        shared_lock_guard(Mutex& m_,adopt_lock_t):
            m(m_)
        {}
        ~shared_lock_guard()
        {
            m.unlock_shared();
        }
    };

comment:2 by Andrey Semashev, 13 years ago

Yes, exactly.

comment:3 by viboes, 13 years ago

Cc: viboes added
Severity: OptimizationNot Applicable
Type: Feature RequestsPatches

comment:4 by viboes, 12 years ago

Type: PatchesFeature Requests

Comeback to Feature request as the patch is not complete.

comment:5 by viboes, 11 years ago

Owner: changed from Anthony Williams to viboes
Status: newassigned

comment:6 by viboes, 11 years ago

Milestone: Boost 1.41.0Boost 1.50.0

by viboes, 11 years ago

Attachment: 3567.path added

comment:7 by viboes, 11 years ago

Committed in trunk revision 77661.

comment:8 by viboes, 10 years ago

Resolution: fixed
Status: assignedclosed

Committed in release branch at [78543]

Note: See TracTickets for help on using tickets.