Modify

Ticket #3567 (closed Feature Requests: fixed)

Opened 4 years ago

Last modified 23 months ago

Request for shared_lock_guard

Reported by: andysem 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

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

Change History

comment:1 Changed 4 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 4 years ago by andysem

Yes, exactly.

comment:3 Changed 4 years ago by viboes

  • Cc viboes added
  • Type changed from Feature Requests to Patches
  • Severity changed from Optimization to Not Applicable

comment:4 Changed 3 years ago by viboes

  • Type changed from Patches to Feature Requests

Comeback to Feature request as the patch is not complete.

comment:5 Changed 2 years ago by viboes

  • Owner changed from anthonyw to viboes
  • Status changed from new to assigned

comment:6 Changed 2 years ago by viboes

  • Milestone changed from Boost 1.41.0 to Boost 1.50.0

Changed 2 years ago by viboes

comment:7 Changed 2 years ago by viboes

Committed in trunk revision 77661.

comment:8 Changed 23 months ago by viboes

  • Status changed from assigned to closed
  • Resolution set to fixed

Committed in release branch at [78543]

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.