matching ${TZDIR} setting for, //absl/time/internal/cctz:zoneinfo.
This eliminates any hidden dependency on /usr/share/zoneinfo, and
enables the upcoming deletion of the embedded internal/zoneinfo.inc
data from //absl/time:test_util.
PiperOrigin-RevId: 488372848
Change-Id: If1c8525b5ca4348cb2fc3b4760819f791b6e9725
Previously, ~raw_hash_set() would change *this to have the same
representation as an empty hash table. This is unnecessary since
nobody should be touching a destroyed hash table, and prevents future
optimizations/changes that might not be able to preserve this
behavior.
PiperOrigin-RevId: 487899950
Change-Id: I2d4470677bdd411c2e48ef511187e39f4e7fc2f4
This fixes the build on arm64 macOS.
Note that hardware acceleration is not yet enabled on arm64 when not
running under Linux.
Addresses the report from 1687dbf814 (commitcomment-89529264)
PiperOrigin-RevId: 487655295
Change-Id: I168dfc863c960d0b694b26dfcb85ff0fd0e95a1e
- Add assertions that the iterators are either (a) from the same container or (b) both default constructed. Standard says: "The domain of == for forward iterators is that of iterators over the same underlying sequence. However, value-initialized iterators may be compared and shall compare equal to other value-initialized iterators of the same type." - [reference](https://eel.is/c++draft/forward.iterators#2).
- Also optimize IsEndIterator a bit.
PiperOrigin-RevId: 487617518
Change-Id: Iefba5c3bc8caa93954671793e6929e22f419c298
deprecation of ATOMIC_FLAG_INIT.
Another option would have been to use macros to only initialize
std::atomic_flag before C++20, but I decided to use one compilation
path instead.
The major difference between std::atomic_flag and std::atomic<bool> is
that the former is guaranteed to be lock-free, but we already assume
std::atomic<bool> is lock-free in many places.
https://en.cppreference.com/w/cpp/atomic/atomic_flag
PiperOrigin-RevId: 487397075
Change-Id: I3f1c539ec8b2ca58547282e69ed73e93243e8efe
This implementation can advantage of hardware acceleration available
on common CPUs when using GCC and Clang. A future update may enable
this on MSVC as well.
PiperOrigin-RevId: 487327024
Change-Id: I99a8f1bcbdf25297e776537e23bd0a902e0818a1
We check for comparisons of swisstable iterators from different heap allocations, which can indicate either iterators from different containers or that there was a rehash between when the iterators were initialized.
PiperOrigin-RevId: 487304602
Change-Id: I5c596c5ea07948d66e048f99937f9032a630344f
Note that multi{set,map}::emplace doesn't specify in which order the new element is inserted if there are equivalent keys in the table, whereas emplace_hint specifies that the new element must be before the hint if possible.
https://en.cppreference.com/w/cpp/container/multiset/emplacehttps://en.cppreference.com/w/cpp/container/multiset/emplace_hint
Also refactor to rely on IsAssertEnabled instead of checking for NDEBUG.
PiperOrigin-RevId: 486733450
Change-Id: Ie90d33c584a6caccd8301ad6fc0396234dbbfac4
In order for Condition to work on Microsoft platforms, it has to store pointers to methods that are larger than we usually expect. MSVC pointers to methods from class hierarchies that employ multiple inheritance or virtual inheritance are strictly larger than pointers to methods in class hierarchies that only employ single inheritance.
This change introduces an opaque declaration of a class, which is not fulfilled. This declaration is used to calculate the size of the Condition method pointer allocation. Because the declaration is of unspecified inheritance, the compiler is forced to use a conservatively large allocation, which will thereby accommodate all method pointer sizes.
Because the `method_` and `function_` callbacks are only populated in mutually exclusive conditions, they can be allowed to take up the same space in the Condition object. This change combines the `method_` and `function_` fields and renames the new field to `callback_`. The constructor logic is updated to reflect the new field.
PiperOrigin-RevId: 486701312
Change-Id: If06832cc26f27d91e295183e44dc29440af5f9db
If a user-defined type has `AbslStringify()` defined, it will always be used for logging over `operator<<`.
`HasAbslStringify` now uses the empty class `UnimplementedSink` for its checks instead of `StringifySink` in order to make it work in cases involving other sinks.
PiperOrigin-RevId: 485710377
Change-Id: Ibdd916151c7abc3269c35fbe79b772867f3d25e1
- Separate the failure cases into different assertions: end/default constructed vs rehashed or erased.
- Update the assertion error for AssertIsValid to not mention the end iterator case because end iterators are considered valid by AssertIsValid.
- Also fix an out-of-date comment for skip_empty_or_deleted.
PiperOrigin-RevId: 485402559
Change-Id: I593056abdc6c3565d0396fb885923fef643bf4e4
This function is unnecessary as it was originally used to support modifiers with `absl::StrFormat()`. This functionality is irrelevant to `absl::StrCat()`.
PiperOrigin-RevId: 484339246
Change-Id: I8c4a0ee01b30aee7a83f6ab54e5465465cc9cc56
ABSL_RANDOM_RANDEN_COPTS
Everything works fine when this is empty
Fixes#1301
PiperOrigin-RevId: 484014466
Change-Id: I2fa96d845320f23063e1e86ee2df3ac14bd44012
- Check for invalid generation before checking for other types of invalid iterators.
- Check specifically for dereferencing end() iterators.
PiperOrigin-RevId: 483725646
Change-Id: Ibca19c48b1b242384683580145be8fb9ae707bc8
On single-core systems, a thread could be preempted while holding an
absl::Mutex, or even worse, the spin lock. If a FIFO thread wakes up and
tries to acquire this lock, it might not be able to yield() to the sleeping
thread.
Within MutexDelay(), a yield() and a sleep(10us) are used to yield the CPU.
The yield() would do nothing if the calling thread holds the highest
priority in the system. The 10us sleep() may not be able to reach the
scheduler either, if the system is slow enough.
This code path is known to be reachable in the following scenarios:
- a FIFO thread calls LockSlowLoop() with spin lock held by a normal thread
- a FIFO thread calls LockWhen*() with the Mutex held by a normal thread for a long time
- a FIFO thread calls Await*(), releases the Mutex to be held by a normal thread for a long time
This CL adds a mutex global for the sleep time, and sets it using the
return time of the a yield() call. Yield() must reach the
scheduler even when it fails to yield to anyone, and would allow sleep() to do the
same. A small constant multiplier (5) is also applied to overcome uncontrollable
factors in the runtime and help sleep() to consistently yield to another thread.
Upper and lower bounds for the sleep time is also controlled to block any unreasonable values.
PiperOrigin-RevId: 483459711
Change-Id: I14efadbadaf9244a2462f377b515147bda651c89
The SetLogtostderr and SetAlsologtostderr tests are setting flags that cause the stderrthreshold global value to be out of sync with the stderrthreshold flag. As a result, it is not currently possible to remove order dependency with these existing tests.
PiperOrigin-RevId: 481731395
Change-Id: Ie992520982f2e69821d1d1b660e3326bf745ef0d
Note: btree_iterator::operator- is still O(N) because in the worst case (end()-begin()), we will have at least one operation per node in the tree, and there are at least N/M nodes, where M (a constant) is the maximum number of values per node.
PiperOrigin-RevId: 481716874
Change-Id: Ic0225b7509208ed96b75a2dc626d2aa4a24f4946