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

Fix ABSL_WAITER_MODE detection for mingw #342

Merged
merged 4 commits into from
Oct 10, 2019

Conversation

jtsylve
Copy link
Contributor

@jtsylve jtsylve commented Jun 25, 2019

The synchronization APIs used in ABSL_WAITER_MODE_WIN32 are only available starting in Windows Vista. By default, mingw sets _WIN32_WINNT to Windows XP causing compilation to fail. This PR addresses this issue by adding an additional check.

@jtsylve
Copy link
Contributor Author

jtsylve commented Jul 8, 2019

rebased against master

@@ -40,7 +40,7 @@

#if defined(ABSL_FORCE_WAITER_MODE)
#define ABSL_WAITER_MODE ABSL_FORCE_WAITER_MODE
#elif defined(_WIN32)
#elif defined(_WIN32) && _WIN32_WINNT >= 0x0600
Copy link
Contributor

@suertreus suertreus Jul 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would you feel about comparing against _WIN32_WINNT_VISTA instead of the magic constant? Looks like you'd have to conditionally #include <SdkDdkVer.h>.

If that's not possible or desirable, please add a comment indicating that 0x0600 corresponds to Vista.

@shaindelschwartz
Copy link
Contributor

@jtsylve Would you like to follow up here? There's an open review comment that should be resolved before we merge this.

today is not my day
@suertreus suertreus merged commit e9f9000 into abseil:master Oct 10, 2019
absl-federation-github pushed a commit that referenced this pull request Oct 16, 2019
--
f13697e3d33803f9667d124072da4f6dd8bfbf85 by Andy Soffer <asoffer@google.com>:

Addressing #314, fixing
CMakeLists.txt to reference ABSL_TEST_COPTS rather than ABSL_DEFAULT_COPTS.

ABSL_TEST_COPTS should be preferred for all tests so that they are configured consistently (moreover, CMake should agree with Bazel).

PiperOrigin-RevId: 274932312

--
c31c24a1fa6bb98136adf51ef37c0818ac366690 by Derek Mauro <dmauro@google.com>:

Silence MSAN in the stack consumption test utility

PiperOrigin-RevId: 274912950

--
2412913c05a246cd527cd4c31452f126e9129f3a by CJ Johnson <johnsoncj@google.com>:

Internal change

PiperOrigin-RevId: 274847103

--
75e984a93b5760873501b96ac3229ccfd955daf8 by Abseil Team <absl-team@google.com>:

Reformat BUILD file to current standards.

PiperOrigin-RevId: 274815392

--
a2780e085f1df1e4ca2c814a58c893d1b78a1d9c by Samuel Benzaquen <sbenza@google.com>:

Fix invalid result regarding leading zeros in the exponent.

PiperOrigin-RevId: 274808017

--
dd402e1cb5c4ebacb576372ae24bf289d729d323 by Samuel Benzaquen <sbenza@google.com>:

Make string_view's relational operators constexpr when possible.

PiperOrigin-RevId: 274807873

--
b4ef32565653a5da1cb8bb8d0351586d23519658 by Abseil Team <absl-team@google.com>:

Internal rework.

PiperOrigin-RevId: 274787159

--
70d81971c5914e6785b8e8a9d4f6eb2655dd62c0 by Gennadiy Rozental <rogeeff@google.com>:

Internal rework.

PiperOrigin-RevId: 274715557

--
14f5b0440e353b899cafaaa15b53e77f98f401af by Gennadiy Rozental <rogeeff@google.com>:

Make deprecated statements about ParseFLag/UnparseFlag consistent in a file.

PiperOrigin-RevId: 274668123

--
2e85adbdbb92612e4d750bc34fbca3333128b42d by Abseil Team <absl-team@google.com>:

Allow absl::c_equal to be used with arrays.

This is achieved by allowing container size computation for arrays.

PiperOrigin-RevId: 274426830

--
219719f107226d328773e6cec99fb473f5d3119c by Gennadiy Rozental <rogeeff@google.com>:

Release correct extension interfaces to support usage of absl::Time and absl::Duration as ABSL_FLAG

PiperOrigin-RevId: 274273788

--
47a77f93fda23b69b4a6bdbd506fe643c69a5579 by Gennadiy Rozental <rogeeff@google.com>:

Rework of flags persistence/FlagSaver internals.

PiperOrigin-RevId: 274225213

--
7807be3fe757c19e3b0c487298387683d4c9f5b3 by Abseil Team <absl-team@google.com>:

Switch reference to sdkddkver.h to lowercase, matching conventions used in the Windows SDK and other uses. This helps to avoid confusion on case-sensitive filesystems.

PiperOrigin-RevId: 274061877

--
561304090087a19f1d10f0475f564fe132ebf06e by Andy Getzendanner <durandal@google.com>:

Fix ABSL_WAITER_MODE detection for mingw

Import of #342

PiperOrigin-RevId: 274030071

--
9b3caac2cf202b9d440dfa1b4ffd538ac4bf715b by Derek Mauro <dmauro@google.com>:

Support using Abseil with the musl libc implementation.

Only test changes were required:
  * Workaround for a bug in sigaltstack() on musl
  * printf-style pointer formatting (%p) is implementation defined,
    so verify StrFromat produces something compatible
  * Fix detection of feenableexcept()

PiperOrigin-RevId: 274011666

--
73e8a938fc139e1cc8670d4513a445bacc855539 by Abseil Team <absl-team@google.com>:

nvcc workaround: explicitly specify the definition of node_handle::Base

PiperOrigin-RevId: 274011392

--
ab9cc6d042aca7d48e16c504ab10eab39433f4b2 by Andy Soffer <asoffer@google.com>:

Internal change

PiperOrigin-RevId: 273996318

--
e567c4979ca99c7e71821ec1523b8f5edd2c76ac by Abseil Team <absl-team@google.com>:

Introduce a type alias to work around an nvcc bug.

On the previous code, nvcc gets confused thinking that T has to be a parameter
pack, as IsDecomposable accepts one.

PiperOrigin-RevId: 273980472

--
105b6e6339b77a32f4432de05f44cd3f9c436751 by Eric Fiselier <ericwf@google.com>:

Import of CCTZ from GitHub.

PiperOrigin-RevId: 273955589

--
8feb87ff1d7e721fe094855e67c19539d5e582b7 by Abseil Team <absl-team@google.com>:

Avoid dual-exporting scheduling_mode.h

PiperOrigin-RevId: 273825112

--
fbc37854776d295dae98fb9d06a541f296daab95 by Andy Getzendanner <durandal@google.com>:

Fix ABSL_HAVE_ALARM check on mingw

Import of #341

PiperOrigin-RevId: 273817839

--
6aedcd63a735b9133e143b043744ba0a25407f6f by Andy Soffer <asoffer@google.com>:

Remove bit_gen_view.h now that all callers have been migrated to bit_gen_ref.h
Tested:
TGP - https://test.corp.google.com/ui#id=OCL:273762409:BASE:273743370:1570639020744:3001bcb5

PiperOrigin-RevId: 273810331

--
6573de24a66ba715c579f7f32b5c48a1d743c7f8 by Abseil Team <absl-team@google.com>:

Internal change.

PiperOrigin-RevId: 273589963

--
91c8c28b6dca26d98b39e8e06a8ed17c701ff793 by Abseil Team <absl-team@google.com>:

Update macro name for `ABSL_GUARDED_BY()` in the example section.

PiperOrigin-RevId: 273286983

--
0ff7d1a93d70f8ecd693f8dbb98b7a4a016ca2a4 by Abseil Team <absl-team@google.com>:

Fix potential integer overflow in the absl time library.

In absl::FromTM, the tm.tm_year is added by 1900 regarding that tm.tm_year represents the years since 1900. This change checks integer overflow before doing the arithmetic operation.

PiperOrigin-RevId: 273092952

--
b41c2a1310086807be09a833099ae6d4009f037c by Gennadiy Rozental <rogeeff@google.com>:

Correctly Unlock the global mutex in case of concurrent flag initialization.

Fixes #386

PiperOrigin-RevId: 272979749

--
c53103e71b2a6063af3c6d4ff68aa2d8f9ae9e06 by Abseil Team <absl-team@google.com>:

Try to become idle only when there is no wakeup.

Immediately after waking up (when futex wait returns), the current thread tries
to become idle doing bunch of memory loads and a branch.  Problem is that there
is a good chance that we woke up due to a wakeup, especially for actively used
threads.  For such wakeups, calling MaybeBecomeIdle() would be a waste of
cycles.

Instead, call MaybeBecomeIdle() only when we are sure there is no wakeup.  For
idle threads the net effect should be the same.  For active, threads this will
be more efficient.

Moreover, since MaybeBecomeIdle() is called before waiting on the futex, the
current thread will try to become idle before sleeping.  This should result
in more accurate idleness and more efficient release of thread resources.

PiperOrigin-RevId: 272940381
GitOrigin-RevId: f13697e3d33803f9667d124072da4f6dd8bfbf85
Change-Id: I36de05aec12595183725652dd362dfa58fb095d0
absl-federation-github pushed a commit that referenced this pull request Feb 25, 2020
  - 0033c9e Fix build on FreeBSD/powerpc (#616) by kgotlinux <60880393+kgotlinux@users.noreply.github.com>
  - 0d5ce27 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - b69c7d8 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 2a5633f Merge "Export of internal Abseil changes" by Xiaoyi Zhang <zhangxy@google.com>
  - f9b3d6e Add RISCV support to GetProgramCounter() (#621) by Khem Raj <raj.khem@gmail.com>
  - 0232c87 Add missing ABSL_HAVE_VDSO_SUPPORT conditional (#622) by Sinan Kaya <41809318+franksinankaya@users.noreply.github.com>
  - 3c81410 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - c44657f Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 98eb410 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - bf78e97 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - d95d156 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 24713a7 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 72382c2 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 08a7e7b Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 36bcd95 Fix pointer format specifier in documentation (#614) by Andre Nguyen <andre-nguyen@users.noreply.github.com>
  - 0f86336 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - c512f11 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 37dd256 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 4442770 fix: Add support for more ARM processors detection (#608) by Andre Nguyen <andre-nguyen@users.noreply.github.com>
  - 159bf2b Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - a2e6ade Use https links. (#586) by nlewycky <nicholas@mxc.ca>
  - 564001a Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - b3aaac8 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 63ee2f8 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - a048203 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 1de0166 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - ad904b6 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 2923513 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - bf86cfe Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 12bc53e Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 1e39f86 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 77f8700 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - d659fe5 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - a4b757b Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 0514227 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 7f4fe64 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 16d9fd5 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - bcaae60 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 8ba96a8 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 2103fd9 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 3df7b52 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - fa8c751 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 85092b4 Fix Conan builds (#400) by Adrian Ostrowski <adr.ostrowski@gmail.com>
  - e96ae22 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 20de2db Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 846e5db Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 8207907 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 078b89b Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 19b021c Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - ecc0033 Always enable proper symbolize implementation on Windows ... by Loo Rong Jie <loorongjie@gmail.com>
  - 2796d50 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - e4c8d0e Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - a15364c Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - ab3552a Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - e9f9000 Fix ABSL_WAITER_MODE detection for mingw (#342) by Joe Sylve <Joe.Sylve@gmail.com>
  - abea769 Fix ABSL_HAVE_ALARM check on mingw (#341) by Joe Sylve <Joe.Sylve@gmail.com>
  - 25597bd Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - aad33fe Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 8fe7214 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - debac94 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 882b350 Fix spelling errors (#384) by Sungmann Cho <55860394+chosungmann@users.noreply.github.com>
  - 502efe6 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - ccdd1d5 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - ddf8e52 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 6ec1362 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - ac78ffc Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 5374c56 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 97c1664 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 325fd7b Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 83c1d65 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - eb6b7bd Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 9ddac55 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 1948f6f Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - a0d1e09 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 2d2d7fb Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 0302d1e supppress unused variable warning for gcc (#372) by Martin <pizzard@users.noreply.github.com>
  - 262d74b Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - f0afae0 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 0e7afdc Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 9a41ffd Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 36910d3 [bazel] Add fixes for --incompatible_load_cc_rules_from_b... by Yannic <contact@yannic-bonenberger.com>
  - aae8143 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - d9aa92d Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 321ab53 Export of internal Abseil changes by Abseil Team <absl-team@google.com>
  - 4ef5740 Export of internal Abseil changes by Abseil Team <absl-team@google.com>

GitOrigin-RevId: 0033c9e
Change-Id: I8a2b70063cb3ab40c6943a6db0fe40cae71ed8d7
rongjiecomputer pushed a commit to rongjiecomputer/abseil-cpp that referenced this pull request Oct 8, 2020
* Fix ABSL_WAITER_MODE detection for mingw
rongjiecomputer pushed a commit to rongjiecomputer/abseil-cpp that referenced this pull request Oct 8, 2020
--
f13697e3d33803f9667d124072da4f6dd8bfbf85 by Andy Soffer <asoffer@google.com>:

Addressing abseil#314, fixing
CMakeLists.txt to reference ABSL_TEST_COPTS rather than ABSL_DEFAULT_COPTS.

ABSL_TEST_COPTS should be preferred for all tests so that they are configured consistently (moreover, CMake should agree with Bazel).

PiperOrigin-RevId: 274932312

--
c31c24a1fa6bb98136adf51ef37c0818ac366690 by Derek Mauro <dmauro@google.com>:

Silence MSAN in the stack consumption test utility

PiperOrigin-RevId: 274912950

--
2412913c05a246cd527cd4c31452f126e9129f3a by CJ Johnson <johnsoncj@google.com>:

Internal change

PiperOrigin-RevId: 274847103

--
75e984a93b5760873501b96ac3229ccfd955daf8 by Abseil Team <absl-team@google.com>:

Reformat BUILD file to current standards.

PiperOrigin-RevId: 274815392

--
a2780e085f1df1e4ca2c814a58c893d1b78a1d9c by Samuel Benzaquen <sbenza@google.com>:

Fix invalid result regarding leading zeros in the exponent.

PiperOrigin-RevId: 274808017

--
dd402e1cb5c4ebacb576372ae24bf289d729d323 by Samuel Benzaquen <sbenza@google.com>:

Make string_view's relational operators constexpr when possible.

PiperOrigin-RevId: 274807873

--
b4ef32565653a5da1cb8bb8d0351586d23519658 by Abseil Team <absl-team@google.com>:

Internal rework.

PiperOrigin-RevId: 274787159

--
70d81971c5914e6785b8e8a9d4f6eb2655dd62c0 by Gennadiy Rozental <rogeeff@google.com>:

Internal rework.

PiperOrigin-RevId: 274715557

--
14f5b0440e353b899cafaaa15b53e77f98f401af by Gennadiy Rozental <rogeeff@google.com>:

Make deprecated statements about ParseFLag/UnparseFlag consistent in a file.

PiperOrigin-RevId: 274668123

--
2e85adbdbb92612e4d750bc34fbca3333128b42d by Abseil Team <absl-team@google.com>:

Allow absl::c_equal to be used with arrays.

This is achieved by allowing container size computation for arrays.

PiperOrigin-RevId: 274426830

--
219719f107226d328773e6cec99fb473f5d3119c by Gennadiy Rozental <rogeeff@google.com>:

Release correct extension interfaces to support usage of absl::Time and absl::Duration as ABSL_FLAG

PiperOrigin-RevId: 274273788

--
47a77f93fda23b69b4a6bdbd506fe643c69a5579 by Gennadiy Rozental <rogeeff@google.com>:

Rework of flags persistence/FlagSaver internals.

PiperOrigin-RevId: 274225213

--
7807be3fe757c19e3b0c487298387683d4c9f5b3 by Abseil Team <absl-team@google.com>:

Switch reference to sdkddkver.h to lowercase, matching conventions used in the Windows SDK and other uses. This helps to avoid confusion on case-sensitive filesystems.

PiperOrigin-RevId: 274061877

--
561304090087a19f1d10f0475f564fe132ebf06e by Andy Getzendanner <durandal@google.com>:

Fix ABSL_WAITER_MODE detection for mingw

Import of abseil#342

PiperOrigin-RevId: 274030071

--
9b3caac2cf202b9d440dfa1b4ffd538ac4bf715b by Derek Mauro <dmauro@google.com>:

Support using Abseil with the musl libc implementation.

Only test changes were required:
  * Workaround for a bug in sigaltstack() on musl
  * printf-style pointer formatting (%p) is implementation defined,
    so verify StrFromat produces something compatible
  * Fix detection of feenableexcept()

PiperOrigin-RevId: 274011666

--
73e8a938fc139e1cc8670d4513a445bacc855539 by Abseil Team <absl-team@google.com>:

nvcc workaround: explicitly specify the definition of node_handle::Base

PiperOrigin-RevId: 274011392

--
ab9cc6d042aca7d48e16c504ab10eab39433f4b2 by Andy Soffer <asoffer@google.com>:

Internal change

PiperOrigin-RevId: 273996318

--
e567c4979ca99c7e71821ec1523b8f5edd2c76ac by Abseil Team <absl-team@google.com>:

Introduce a type alias to work around an nvcc bug.

On the previous code, nvcc gets confused thinking that T has to be a parameter
pack, as IsDecomposable accepts one.

PiperOrigin-RevId: 273980472

--
105b6e6339b77a32f4432de05f44cd3f9c436751 by Eric Fiselier <ericwf@google.com>:

Import of CCTZ from GitHub.

PiperOrigin-RevId: 273955589

--
8feb87ff1d7e721fe094855e67c19539d5e582b7 by Abseil Team <absl-team@google.com>:

Avoid dual-exporting scheduling_mode.h

PiperOrigin-RevId: 273825112

--
fbc37854776d295dae98fb9d06a541f296daab95 by Andy Getzendanner <durandal@google.com>:

Fix ABSL_HAVE_ALARM check on mingw

Import of abseil#341

PiperOrigin-RevId: 273817839

--
6aedcd63a735b9133e143b043744ba0a25407f6f by Andy Soffer <asoffer@google.com>:

Remove bit_gen_view.h now that all callers have been migrated to bit_gen_ref.h
Tested:
TGP - https://test.corp.google.com/ui#id=OCL:273762409:BASE:273743370:1570639020744:3001bcb5

PiperOrigin-RevId: 273810331

--
6573de24a66ba715c579f7f32b5c48a1d743c7f8 by Abseil Team <absl-team@google.com>:

Internal change.

PiperOrigin-RevId: 273589963

--
91c8c28b6dca26d98b39e8e06a8ed17c701ff793 by Abseil Team <absl-team@google.com>:

Update macro name for `ABSL_GUARDED_BY()` in the example section.

PiperOrigin-RevId: 273286983

--
0ff7d1a93d70f8ecd693f8dbb98b7a4a016ca2a4 by Abseil Team <absl-team@google.com>:

Fix potential integer overflow in the absl time library.

In absl::FromTM, the tm.tm_year is added by 1900 regarding that tm.tm_year represents the years since 1900. This change checks integer overflow before doing the arithmetic operation.

PiperOrigin-RevId: 273092952

--
b41c2a1310086807be09a833099ae6d4009f037c by Gennadiy Rozental <rogeeff@google.com>:

Correctly Unlock the global mutex in case of concurrent flag initialization.

Fixes abseil#386

PiperOrigin-RevId: 272979749

--
c53103e71b2a6063af3c6d4ff68aa2d8f9ae9e06 by Abseil Team <absl-team@google.com>:

Try to become idle only when there is no wakeup.

Immediately after waking up (when futex wait returns), the current thread tries
to become idle doing bunch of memory loads and a branch.  Problem is that there
is a good chance that we woke up due to a wakeup, especially for actively used
threads.  For such wakeups, calling MaybeBecomeIdle() would be a waste of
cycles.

Instead, call MaybeBecomeIdle() only when we are sure there is no wakeup.  For
idle threads the net effect should be the same.  For active, threads this will
be more efficient.

Moreover, since MaybeBecomeIdle() is called before waiting on the futex, the
current thread will try to become idle before sleeping.  This should result
in more accurate idleness and more efficient release of thread resources.

PiperOrigin-RevId: 272940381
GitOrigin-RevId: f13697e3d33803f9667d124072da4f6dd8bfbf85
Change-Id: I36de05aec12595183725652dd362dfa58fb095d0
4s5t2os41n added a commit to 4s5t2os41n/abseil-cpp that referenced this pull request Jul 4, 2024
--
f13697e3d33803f9667d124072da4f6dd8bfbf85 by Andy Soffer <asoffer@google.com>:

Addressing abseil/abseil-cpp#314, fixing
CMakeLists.txt to reference ABSL_TEST_COPTS rather than ABSL_DEFAULT_COPTS.

ABSL_TEST_COPTS should be preferred for all tests so that they are configured consistently (moreover, CMake should agree with Bazel).

PiperOrigin-RevId: 274932312

--
c31c24a1fa6bb98136adf51ef37c0818ac366690 by Derek Mauro <dmauro@google.com>:

Silence MSAN in the stack consumption test utility

PiperOrigin-RevId: 274912950

--
2412913c05a246cd527cd4c31452f126e9129f3a by CJ Johnson <johnsoncj@google.com>:

Internal change

PiperOrigin-RevId: 274847103

--
75e984a93b5760873501b96ac3229ccfd955daf8 by Abseil Team <absl-team@google.com>:

Reformat BUILD file to current standards.

PiperOrigin-RevId: 274815392

--
a2780e085f1df1e4ca2c814a58c893d1b78a1d9c by Samuel Benzaquen <sbenza@google.com>:

Fix invalid result regarding leading zeros in the exponent.

PiperOrigin-RevId: 274808017

--
dd402e1cb5c4ebacb576372ae24bf289d729d323 by Samuel Benzaquen <sbenza@google.com>:

Make string_view's relational operators constexpr when possible.

PiperOrigin-RevId: 274807873

--
b4ef32565653a5da1cb8bb8d0351586d23519658 by Abseil Team <absl-team@google.com>:

Internal rework.

PiperOrigin-RevId: 274787159

--
70d81971c5914e6785b8e8a9d4f6eb2655dd62c0 by Gennadiy Rozental <rogeeff@google.com>:

Internal rework.

PiperOrigin-RevId: 274715557

--
14f5b0440e353b899cafaaa15b53e77f98f401af by Gennadiy Rozental <rogeeff@google.com>:

Make deprecated statements about ParseFLag/UnparseFlag consistent in a file.

PiperOrigin-RevId: 274668123

--
2e85adbdbb92612e4d750bc34fbca3333128b42d by Abseil Team <absl-team@google.com>:

Allow absl::c_equal to be used with arrays.

This is achieved by allowing container size computation for arrays.

PiperOrigin-RevId: 274426830

--
219719f107226d328773e6cec99fb473f5d3119c by Gennadiy Rozental <rogeeff@google.com>:

Release correct extension interfaces to support usage of absl::Time and absl::Duration as ABSL_FLAG

PiperOrigin-RevId: 274273788

--
47a77f93fda23b69b4a6bdbd506fe643c69a5579 by Gennadiy Rozental <rogeeff@google.com>:

Rework of flags persistence/FlagSaver internals.

PiperOrigin-RevId: 274225213

--
7807be3fe757c19e3b0c487298387683d4c9f5b3 by Abseil Team <absl-team@google.com>:

Switch reference to sdkddkver.h to lowercase, matching conventions used in the Windows SDK and other uses. This helps to avoid confusion on case-sensitive filesystems.

PiperOrigin-RevId: 274061877

--
561304090087a19f1d10f0475f564fe132ebf06e by Andy Getzendanner <durandal@google.com>:

Fix ABSL_WAITER_MODE detection for mingw

Import of abseil/abseil-cpp#342

PiperOrigin-RevId: 274030071

--
9b3caac2cf202b9d440dfa1b4ffd538ac4bf715b by Derek Mauro <dmauro@google.com>:

Support using Abseil with the musl libc implementation.

Only test changes were required:
  * Workaround for a bug in sigaltstack() on musl
  * printf-style pointer formatting (%p) is implementation defined,
    so verify StrFromat produces something compatible
  * Fix detection of feenableexcept()

PiperOrigin-RevId: 274011666

--
73e8a938fc139e1cc8670d4513a445bacc855539 by Abseil Team <absl-team@google.com>:

nvcc workaround: explicitly specify the definition of node_handle::Base

PiperOrigin-RevId: 274011392

--
ab9cc6d042aca7d48e16c504ab10eab39433f4b2 by Andy Soffer <asoffer@google.com>:

Internal change

PiperOrigin-RevId: 273996318

--
e567c4979ca99c7e71821ec1523b8f5edd2c76ac by Abseil Team <absl-team@google.com>:

Introduce a type alias to work around an nvcc bug.

On the previous code, nvcc gets confused thinking that T has to be a parameter
pack, as IsDecomposable accepts one.

PiperOrigin-RevId: 273980472

--
105b6e6339b77a32f4432de05f44cd3f9c436751 by Eric Fiselier <ericwf@google.com>:

Import of CCTZ from GitHub.

PiperOrigin-RevId: 273955589

--
8feb87ff1d7e721fe094855e67c19539d5e582b7 by Abseil Team <absl-team@google.com>:

Avoid dual-exporting scheduling_mode.h

PiperOrigin-RevId: 273825112

--
fbc37854776d295dae98fb9d06a541f296daab95 by Andy Getzendanner <durandal@google.com>:

Fix ABSL_HAVE_ALARM check on mingw

Import of abseil/abseil-cpp#341

PiperOrigin-RevId: 273817839

--
6aedcd63a735b9133e143b043744ba0a25407f6f by Andy Soffer <asoffer@google.com>:

Remove bit_gen_view.h now that all callers have been migrated to bit_gen_ref.h
Tested:
TGP - https://test.corp.google.com/ui#id=OCL:273762409:BASE:273743370:1570639020744:3001bcb5

PiperOrigin-RevId: 273810331

--
6573de24a66ba715c579f7f32b5c48a1d743c7f8 by Abseil Team <absl-team@google.com>:

Internal change.

PiperOrigin-RevId: 273589963

--
91c8c28b6dca26d98b39e8e06a8ed17c701ff793 by Abseil Team <absl-team@google.com>:

Update macro name for `ABSL_GUARDED_BY()` in the example section.

PiperOrigin-RevId: 273286983

--
0ff7d1a93d70f8ecd693f8dbb98b7a4a016ca2a4 by Abseil Team <absl-team@google.com>:

Fix potential integer overflow in the absl time library.

In absl::FromTM, the tm.tm_year is added by 1900 regarding that tm.tm_year represents the years since 1900. This change checks integer overflow before doing the arithmetic operation.

PiperOrigin-RevId: 273092952

--
b41c2a1310086807be09a833099ae6d4009f037c by Gennadiy Rozental <rogeeff@google.com>:

Correctly Unlock the global mutex in case of concurrent flag initialization.

Fixes #386

PiperOrigin-RevId: 272979749

--
c53103e71b2a6063af3c6d4ff68aa2d8f9ae9e06 by Abseil Team <absl-team@google.com>:

Try to become idle only when there is no wakeup.

Immediately after waking up (when futex wait returns), the current thread tries
to become idle doing bunch of memory loads and a branch.  Problem is that there
is a good chance that we woke up due to a wakeup, especially for actively used
threads.  For such wakeups, calling MaybeBecomeIdle() would be a waste of
cycles.

Instead, call MaybeBecomeIdle() only when we are sure there is no wakeup.  For
idle threads the net effect should be the same.  For active, threads this will
be more efficient.

Moreover, since MaybeBecomeIdle() is called before waiting on the futex, the
current thread will try to become idle before sleeping.  This should result
in more accurate idleness and more efficient release of thread resources.

PiperOrigin-RevId: 272940381
GitOrigin-RevId: f13697e3d33803f9667d124072da4f6dd8bfbf85
Change-Id: I36de05aec12595183725652dd362dfa58fb095d0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants