Commit 3b3783bc77dd3c8b25cd71e8dae124a16034e463

Igor Nazarov 2024-11-18T16:42:47

Reland "Possibly fix FixedQueue.ConcurrentPushPop flakiness" This is a reland of commit 84b175546ec95af14b6a85def7d5b2e81ae5a88a Reverted CL increased flakiness because of incorrect `ASSERT` expressions present in the original code and which should have been also corrected. The fix itself had no new issues. This CL additionally fixes these `ASSERT` expressions. Suspected source of flakiness in both tests is the possibility to call `q.pop()` while `q.empty()` is true. Original fix added check for `enqueueThreadFinished` to break from the loop. New fix instead of checking for `enqueueThreadFinished` to break from the loop, checks if `q.empty()` is true. This change allows processing already pushed values even if the enqueue thread already finished. It is applied to both tests. Additional changes not related to fixing the flakiness: - `std::time()` replaced with `angle::GetCurrentSystemTime()` because `std::time_t` may be integer (Android) while `timeOut` is double. This is confusing. For example, if set `timeOut = 0.5` - actual timeout will still be one second. - fix enqueue thread to actually reach the maximum capacity. - improve dequeue thread to prevent updating to the same of greater capacity. - add extra `ASSERT` checks. - make code in both tests consistent with each other. Original change's description: > Possibly fix FixedQueue.ConcurrentPushPop flakiness > > Queue may be empty when `enqueueThreadFinished` become true. > > This is same as the previous fix for `ConcurrentPushPopWithResize`: > https://chromium-review.googlesource.com/c/angle/angle/+/5823039 > > Change also removes always true expressions from the > `ConcurrentPushPopWithResize` test. > > Bug: b/302739073 > Change-Id: I82ee294208d918b7007d85b2cd90e2642fc1e54f > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6030517 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Igor Nazarov <i.nazarov@samsung.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: b/302739073 Change-Id: I8f3840326f3fceed044fa188245772a5ff7b638d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6038334 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>