-
Notifications
You must be signed in to change notification settings - Fork 1.6k
<mutex>: Make _Mtx_internal_imp_mirror more closely match _Mtx_internal_imp_t
#3763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4ea132c
8c339e1
e3fcbba
6f1a6f6
f1fc626
bc8714b
536d5a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -34,24 +34,22 @@ _EXPORT_STD class condition_variable_any; | |||||||||||||||||||||
| struct _Mtx_internal_imp_mirror { | ||||||||||||||||||||||
| #ifdef _CRT_WINDOWS | ||||||||||||||||||||||
| #ifdef _WIN64 | ||||||||||||||||||||||
| static constexpr size_t _Critical_section_size = 8; | ||||||||||||||||||||||
| static constexpr size_t _Critical_section_size = 16; | ||||||||||||||||||||||
| #else // _WIN64 | ||||||||||||||||||||||
| static constexpr size_t _Critical_section_size = 4; | ||||||||||||||||||||||
| static constexpr size_t _Critical_section_size = 8; | ||||||||||||||||||||||
| #endif // _WIN64 | ||||||||||||||||||||||
| #else // _CRT_WINDOWS | ||||||||||||||||||||||
| #ifdef _WIN64 | ||||||||||||||||||||||
| static constexpr size_t _Critical_section_size = 56; | ||||||||||||||||||||||
| static constexpr size_t _Critical_section_size = 64; | ||||||||||||||||||||||
| #else // _WIN64 | ||||||||||||||||||||||
| static constexpr size_t _Critical_section_size = 32; | ||||||||||||||||||||||
| static constexpr size_t _Critical_section_size = 36; | ||||||||||||||||||||||
| #endif // _WIN64 | ||||||||||||||||||||||
| #endif // _CRT_WINDOWS | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| static constexpr size_t _Critical_section_align = alignof(void*); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| int _Type; | ||||||||||||||||||||||
| const void* _Vptr; | ||||||||||||||||||||||
|
StephanTLavavej marked this conversation as resolved.
|
||||||||||||||||||||||
| union { | ||||||||||||||||||||||
| void* _Srw_lock_placeholder; | ||||||||||||||||||||||
| unsigned char _Padding[_Critical_section_size]; | ||||||||||||||||||||||
| }; | ||||||||||||||||||||||
| _Aligned_storage_t<_Critical_section_size, _Critical_section_align> _Cs; | ||||||||||||||||||||||
| long _Thread_id; | ||||||||||||||||||||||
| int _Count; | ||||||||||||||||||||||
|
Comment on lines
51
to
54
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No change requested, note to other reviewers: I know this looks really really scary, but I believe it's a good change. This doesn't control the layout, it's just trying to mirror it (hence the name) so the header can directly access Lines 39 to 48 in c8d1efb
The header doesn't care about the details of what's stored within the aligned storage, so we don't need to separately describe the vptr and the class data members within. (This also permits further refactoring as described in the PR comments, but it's a good simplification even aside from that.) The other simplification is that we can now mention the same "size" as |
||||||||||||||||||||||
| }; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.