-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Wait on condition variables independently on system time #4457
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d45c91e
Fix #718
AlexGuteniev 2368361
can't have this forward
AlexGuteniev 6b07b19
format
AlexGuteniev f7a14a3
include order
AlexGuteniev 3e53aab
who needs that
AlexGuteniev d5310c7
lock it
AlexGuteniev a8327f7
format
AlexGuteniev 8fcb46d
`unsigned` => `unsigned int`
StephanTLavavej 46d21e9
Remove unnecessary parentheses.
StephanTLavavej d7b83f9
Define `struct _Cnd_internal_imp_t` within `extern "C"`.
StephanTLavavej 07c74be
Test `<__msvc_threads_core.hpp>` in `GH_001411_core_headers`.
StephanTLavavej 721c67f
Include `<type_traits>`, use the `_Aligned_storage_t` alias.
StephanTLavavej 1d96f71
Use a strict test for clamping.
StephanTLavavej 20c9409
Tag millisecond variables with `_ms`.
StephanTLavavej File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
// __msvc_threads_core.hpp internal header (core) | ||
|
||
// Copyright (c) Microsoft Corporation. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#ifndef __MSVC_THREADS_CORE_HPP | ||
#define __MSVC_THREADS_CORE_HPP | ||
#include <yvals_core.h> | ||
#if _STL_COMPILER_PREPROCESSOR | ||
#include <type_traits> | ||
|
||
#pragma pack(push, _CRT_PACKING) | ||
#pragma warning(push, _STL_WARNING_LEVEL) | ||
#pragma warning(disable : _STL_DISABLED_WARNINGS) | ||
_STL_DISABLE_CLANG_WARNINGS | ||
#pragma push_macro("new") | ||
#undef new | ||
|
||
extern "C" { | ||
using _Thrd_id_t = unsigned int; | ||
struct _Thrd_t { // thread identifier for Win32 | ||
void* _Hnd; // Win32 HANDLE | ||
_Thrd_id_t _Id; | ||
}; | ||
|
||
using _Smtx_t = void*; | ||
|
||
enum class _Thrd_result : int { _Success, _Nomem, _Timedout, _Busy, _Error }; | ||
|
||
struct _Stl_critical_section { | ||
void* _Unused = nullptr; // TRANSITION, ABI: was the vptr | ||
_Smtx_t _M_srw_lock = nullptr; | ||
}; | ||
|
||
struct _Mtx_internal_imp_t { | ||
#if defined(_CRT_WINDOWS) || defined(UNDOCKED_WINDOWS_UCRT) | ||
#ifdef _WIN64 | ||
static constexpr size_t _Critical_section_size = 16; | ||
#else // ^^^ defined(_WIN64) / !defined(_WIN64) vvv | ||
static constexpr size_t _Critical_section_size = 8; | ||
#endif // ^^^ !defined(_WIN64) ^^^ | ||
#else // ^^^ Windows private STL / public STL vvv | ||
#ifdef _WIN64 | ||
static constexpr size_t _Critical_section_size = 64; | ||
#else // ^^^ defined(_WIN64) / !defined(_WIN64) vvv | ||
static constexpr size_t _Critical_section_size = 36; | ||
#endif // ^^^ !defined(_WIN64) ^^^ | ||
#endif // ^^^ public STL ^^^ | ||
|
||
static constexpr size_t _Critical_section_align = alignof(void*); | ||
|
||
int _Type{}; | ||
union { | ||
_Stl_critical_section _Critical_section{}; | ||
_STD _Aligned_storage_t<_Critical_section_size, _Critical_section_align> _Cs_storage; | ||
}; | ||
long _Thread_id{}; | ||
int _Count{}; | ||
}; | ||
|
||
// Size and alignment for _Cnd_internal_imp_t | ||
#if defined(_CRT_WINDOWS) // for Windows-internal code | ||
_INLINE_VAR constexpr size_t _Cnd_internal_imp_size = 2 * sizeof(void*); | ||
#elif defined(_WIN64) // ordinary 64-bit code | ||
_INLINE_VAR constexpr size_t _Cnd_internal_imp_size = 72; | ||
#else // vvv ordinary 32-bit code vvv | ||
_INLINE_VAR constexpr size_t _Cnd_internal_imp_size = 40; | ||
#endif // ^^^ ordinary 32-bit code ^^^ | ||
|
||
_INLINE_VAR constexpr size_t _Cnd_internal_imp_alignment = alignof(void*); | ||
|
||
using _Mtx_t = _Mtx_internal_imp_t*; | ||
|
||
#ifdef _M_CEE // avoid warning LNK4248: unresolved typeref token for '_Cnd_internal_imp_t'; image may not run | ||
using _Cnd_t = void*; | ||
#else // ^^^ defined(_M_CEE) / !defined(_M_CEE) vvv | ||
struct _Cnd_internal_imp_t; | ||
using _Cnd_t = _Cnd_internal_imp_t*; | ||
#endif // ^^^ !defined(_M_CEE) ^^^ | ||
} // extern "C" | ||
|
||
#pragma pop_macro("new") | ||
_STL_RESTORE_CLANG_WARNINGS | ||
#pragma warning(pop) | ||
#pragma pack(pop) | ||
#endif // _STL_COMPILER_PREPROCESSOR | ||
#endif // __MSVC_THREADS_CORE_HPP | ||
|
||
/* | ||
* This file is derived from software bearing the following | ||
* restrictions: | ||
* | ||
* (c) Copyright William E. Kempf 2001 | ||
* | ||
* Permission to use, copy, modify, distribute and sell this | ||
* software and its documentation for any purpose is hereby | ||
* granted without fee, provided that the above copyright | ||
* notice appear in all copies and that both that copyright | ||
* notice and this permission notice appear in supporting | ||
* documentation. William E. Kempf makes no representations | ||
* about the suitability of this software for any purpose. | ||
* It is provided "as is" without express or implied warranty. | ||
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.