Fix flaky MultiThreadProducerConsumerQueueStopTest
The main thread may run ahead of the closure thread. In this case, Stop() could have been called before the first Push() call. Change-Id: Ib6d94d451a8215fff572ea13f9567ba786d77fa5
This commit is contained in:
parent
a7c91ca7dd
commit
8df0e1ad0a
|
@ -311,7 +311,11 @@ class MultiThreadProducerConsumerQueueStopTest
|
||||||
int val = 0;
|
int val = 0;
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case kPush:
|
case kPush:
|
||||||
CHECK_OK(queue_.Push(0, kInfiniteTimeout));
|
// The queue was setup with size 1. The first push will return STOPPED
|
||||||
|
// if Stop() has been called; otherwise it should return OK and the
|
||||||
|
// second push will block until Stop() being called.
|
||||||
|
status_ = queue_.Push(0, kInfiniteTimeout);
|
||||||
|
if (status_.ok())
|
||||||
status_ = queue_.Push(0, kInfiniteTimeout);
|
status_ = queue_.Push(0, kInfiniteTimeout);
|
||||||
break;
|
break;
|
||||||
case kPop:
|
case kPop:
|
||||||
|
|
Loading…
Reference in New Issue