Skip to content
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

Overhaul condition_variable #4720

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Declare _Mtx_init_in_situ() only when needed.
And update its comment accordingly.
StephanTLavavej committed Jun 9, 2024
commit f8ba7efaa60c53718b3ca9ed8438fe9bdd9a3bc7
2 changes: 2 additions & 0 deletions stl/inc/xthreads.h
Original file line number Diff line number Diff line change
@@ -35,7 +35,9 @@ enum { // mutex types
_Mtx_recursive = 0x100
};

#if defined(_CRTBLD) || defined(_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
_CRTIMP2_PURE void __cdecl _Mtx_init_in_situ(_Mtx_t, int) noexcept;
#endif // ^^^ defined(_CRTBLD) || defined(_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR) ^^^
_CRTIMP2_PURE int __cdecl _Mtx_current_owns(_Mtx_t) noexcept;
_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_lock(_Mtx_t) noexcept;
_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_trylock(_Mtx_t) noexcept;
2 changes: 1 addition & 1 deletion stl/src/mutex.cpp
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ _CRTIMP2 void __cdecl __set_stl_sync_api_mode(__stl_sync_api_modes_enum) noexcep
return reinterpret_cast<PSRWLOCK>(&mtx->_Critical_section._M_srw_lock);
}

// TRANSITION, only used when constexpr mutex constructor is not enabled
// TRANSITION, ABI: preserved for binary compatibility (and _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
_CRTIMP2_PURE void __cdecl _Mtx_init_in_situ(_Mtx_t mtx, int type) noexcept { // initialize mutex in situ
new (&mtx->_Critical_section) _Stl_critical_section;
mtx->_Thread_id = -1;