Skip to content

Conversation

@dmachaj
Copy link
Collaborator

@dmachaj dmachaj commented Jan 21, 2026

Why is this change being made?

Yesterday someone on my team was changing the lock type in some code and hit problems because std::scoped_lock is not on the supported list for wil::read_lock_required/wil::write_lock_required. It seems like they really should be supported, so that's why this PR is being sent.

When I went to add this support I wanted to use the tests to verify expectations for what compiles and what doesn't. I then realized that there is no test coverage for this so I am adding the examples that I used for my local verification. These are basically "does it compile" tests and can never really fail at runtime.

Briefly summarize what changed

Add a specialization of exclusive_lock_proof for std::scoped_lock. Add new test coverage for the lock traits.

As best as I can tell scoped_lock is only for mutexes in STL and therefore is always going to be exclusive. If I am mistaken then please let me know and this should be limited to a more limited shared_lock_proof (or somehow detect the underlying mutex type?).

How was this change tested?

init_all.cmd + build_all.cmd + runtests.cmd. Also ran clang format.

@dmachaj dmachaj requested review from dunhor and jonwis January 22, 2026 00:04
@dunhor dunhor merged commit ddf3bc3 into microsoft:master Jan 23, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants