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,8 +311,12 @@ class MultiThreadProducerConsumerQueueStopTest
|
|||
int val = 0;
|
||||
switch (op) {
|
||||
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);
|
||||
break;
|
||||
case kPop:
|
||||
status_ = queue_.Pop(&val, kInfiniteTimeout);
|
||||
|
|
Loading…
Reference in New Issue