[SERVER-44750] Rename mongo::Latch to Mutex Created: 20/Nov/19  Updated: 06/Dec/22  Resolved: 24/Feb/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Louis Williams Assignee: Backlog - Service Architecture
Resolution: Won't Do Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Service Arch
Participants:

 Description   

Our Latch class is really a generic interface for a Mutex, but because we don't use the "latch" terminology anywhere else in our codebase, the naming can be confusing.

The term "latch" term also conficts with the countdown latch synchronization structure introduced in C++20 as std::latch.



 Comments   
Comment by Lauren Lewis (Inactive) [ 24/Feb/22 ]

We haven’t heard back from you for at least one calendar year, so this issue is being closed. If this is still an issue for you, please provide additional information and we will reopen the ticket.

Comment by Benjamin Caimano (Inactive) [ 30/Jan/20 ]

This ticket came up in conjunction with SERVER-45793. While latch is a term of art for databases, I can freely acknowledge that Lockable would be easier for our developers to understand. I'd like this ticket to make our internal users' daily lives easier.

Our original motivation for the mongo::Latch type was to allow our developers to have an abstract base class for lockable types that could represent an arbitrary internal synchronized resource. I've done a small audit of our use of stdx::unique_guard in function signatures and nearly every reasonable usage takes it by pointer or reference instead of by value. I'd like to propose the following be done in the course of this ticket:

  • Convert stdx::unique_lock<Latch> local and global variable initialization to just stdx::unique_lock so everyone can enjoy CTAD in v4.2 and beyond.
  • Introduce a LockableAdaptor to go with BasicLockableAdaptor.
  • Ban stdx::unique_lock<Foo>* and stdx::unique_lock<Foo>& via linter and replace their use with BasicLockableAdaptor or LockableAdaptor. We're already touching these lines with the conversion, we should make them more flexible as we have with using WithLock.
  • Lastly, rename mongo::Latch to mongo::NamedLockableInterface.
Comment by Bruce Lucas (Inactive) [ 22/Nov/19 ]

I don't how it impacts this, but there is also confusingly a lock type called Mutex.

Generated at Thu Feb 08 05:06:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.