Date: Mon, 8 Sep 2025 20:22:45 +0200
2025-09-08 18:58, Tiago Freire via Std-Proposals:
> Can I use it with std::shared_lock?
Yes, it's meant to be everything a unique_lock is but for zero-to-many
lockables. I think using a `std::shared_mutex`/`std::shared_timed_mutex`
rather than a `std::shared_lock` with it will be more common, but sure,
you can stack them.
Example with 30 shared_timed_mutexes -> 30 shared_locks -> 1
unique_multilock (which makes the unique_multilock a
_SharedTimedLockable_ itself):
https://godbolt.org/z/nGjv8W3Yc
30 is probably an extreme use case but I like to check that compilation
times are reasonable for the example implementation.
Br,
Ted
> ------------------------------------------------------------------------
> *From:* Std-Proposals <std-proposals-bounces_at_[hidden]> on behalf
> of Ville Voutilainen via Std-Proposals <std-proposals_at_[hidden]>
> *Sent:* Monday, September 8, 2025 6:12:06 PM
> *To:* std-proposals_at_[hidden] <std-proposals_at_[hidden]>
> *Cc:* Ville Voutilainen <ville.voutilainen_at_[hidden]>
> *Subject:* Re: [std-proposals] P3833R0a - std::unique_multilock
>
> On Mon, 8 Sept 2025 at 19:06, Ted Lyngmo via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > 2025-09-08 10:51, Jonathan Wakely:
> > > > If anyone has an idea, please share!
> > >
> > > unique_lock_n seems fairly easy to guess what it does from the name.
> > >
> > > Although I suppose all the existing xxx_n names in the library have an
> > > 'n' parameter that tells you the length, whereas here it's implied by
> > > the number of template arguments.
> > Yes, but it may be better to have `unique_lock` first in the name like
> > in unique_lock_n. Perhaps spelling it out to not make people think _n
> > means a numeric argment would be good:
> >
> > unique_lock_many
> > unique_lock_multi
> >
> > ... or some version of that? / Ted
>
> I find unique_multilock a perfectly good name.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals <https://
> lists.isocpp.org/mailman/listinfo.cgi/std-proposals>
>
>
> Can I use it with std::shared_lock?
Yes, it's meant to be everything a unique_lock is but for zero-to-many
lockables. I think using a `std::shared_mutex`/`std::shared_timed_mutex`
rather than a `std::shared_lock` with it will be more common, but sure,
you can stack them.
Example with 30 shared_timed_mutexes -> 30 shared_locks -> 1
unique_multilock (which makes the unique_multilock a
_SharedTimedLockable_ itself):
https://godbolt.org/z/nGjv8W3Yc
30 is probably an extreme use case but I like to check that compilation
times are reasonable for the example implementation.
Br,
Ted
> ------------------------------------------------------------------------
> *From:* Std-Proposals <std-proposals-bounces_at_[hidden]> on behalf
> of Ville Voutilainen via Std-Proposals <std-proposals_at_[hidden]>
> *Sent:* Monday, September 8, 2025 6:12:06 PM
> *To:* std-proposals_at_[hidden] <std-proposals_at_[hidden]>
> *Cc:* Ville Voutilainen <ville.voutilainen_at_[hidden]>
> *Subject:* Re: [std-proposals] P3833R0a - std::unique_multilock
>
> On Mon, 8 Sept 2025 at 19:06, Ted Lyngmo via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > 2025-09-08 10:51, Jonathan Wakely:
> > > > If anyone has an idea, please share!
> > >
> > > unique_lock_n seems fairly easy to guess what it does from the name.
> > >
> > > Although I suppose all the existing xxx_n names in the library have an
> > > 'n' parameter that tells you the length, whereas here it's implied by
> > > the number of template arguments.
> > Yes, but it may be better to have `unique_lock` first in the name like
> > in unique_lock_n. Perhaps spelling it out to not make people think _n
> > means a numeric argment would be good:
> >
> > unique_lock_many
> > unique_lock_multi
> >
> > ... or some version of that? / Ted
>
> I find unique_multilock a perfectly good name.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals <https://
> lists.isocpp.org/mailman/listinfo.cgi/std-proposals>
>
>
Received on 2025-09-08 18:22:45