Modify

Opened 8 years ago

Closed 5 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 6 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 8 years ago by viboes

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 Changed 8 years ago by Andrey Semashev

Yes, exactly.

comment:3 Changed 8 years ago by viboes

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

comment:4 Changed 7 years ago by viboes

Type: PatchesFeature Requests

Comeback to Feature request as the patch is not complete.

comment:5 Changed 6 years ago by viboes

Owner: changed from Anthony Williams to viboes
Status: newassigned

comment:6 Changed 6 years ago by viboes

Milestone: Boost 1.41.0Boost 1.50.0

Changed 6 years ago by viboes

Attachment: 3567.path added

comment:7 Changed 6 years ago by viboes

Committed in trunk revision 77661.

comment:8 Changed 5 years ago by viboes

Resolution: fixed
Status: assignedclosed

Committed in release branch at [78543]

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain viboes.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.