[SERVER-52662] Introduce type-associated mutexes Created: 06/Nov/20  Updated: 23/Feb/23  Resolved: 18/Mar/22

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

Type: Improvement Priority: Major - P3
Reporter: Benjamin Caimano (Inactive) Assignee: Backlog - Service Architecture
Resolution: Won't Do Votes: 0
Labels: ben-sa-triage, re-triaged-ticket
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-51068 HierarchicalAcquisitionLevelViolation... Closed
related to SERVER-52660 Memoize demanagled type names Closed
Assigned Teams:
Service Arch
Participants:

 Description   

When we originally wrote MONGO_MAKE_LATCH here, we considered various macros to accept information from wrapping classes. We eventually decided against this tact in favor of simplicity. We now think it might be worthwhile to absorb this information, especially when the class that needs a mutex is templated. This will require a new macro ala MONGO_MAKE_LATCH_FOR_TYPE that passes its captured type as a template to the registry macro in some form. That macro will need to be able to invoke a unique template instantiation to achieve registry, which means an extra type in its template.



 Comments   
Comment by Blake Oler [ 26/Jan/23 ]

Keeping this closed – we think a human-readable name functions well enough.

Comment by Lauren Lewis (Inactive) [ 18/Mar/22 ]

We haven’t heard back from you for some time, so we're going to close this ticket. If this is still an issue for you, please provide additional information and we will reopen the ticket.

Comment by Benjamin Caimano (Inactive) [ 06/Nov/20 ]

I have a few different ideas for how we can capture the additional type information:

  • getOrMakeLatchData() could take a second template parameter and a fourth argument that uses that parameter. For existing latches, this would default to void and be a constexpr if special case.
  • We could use a new function getOrMakeLatchDataForType() that takes the typeid<T> as the parameter instead of the tag class.
  • We could introduce a CRTP base class LatchHolder<DerivedT> that instantiates and registers the Latch and constructs with a SourceLocation.
Generated at Thu Feb 08 05:28:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.