| 182 | } |
| 183 | |
| 184 | static void ContinuousIssueTraceStatement(ThreadPoolToken* token) { |
| 185 | Random r(SeedRandom()); |
| 186 | // delay_ms is a random time: 1ms or 2ms or 3ms. |
| 187 | int delay_ms = 1 + static_cast<int>(r.Uniform(3)); |
| 188 | Status status = token->Schedule(std::bind(&ContinuousIssueTraceStatement, token), delay_ms); |
| 189 | // At the case, 'pool_->Shutdown();' would shutdown its SchedulerThread firstly, after that |
| 190 | // 'token->Scheduler(...)' would return a IllegalState. |
| 191 | LOG_IF(WARNING, !status.ok()) << "ContinuousIssueTraceStatement: " << status.ToString(); |
| 192 | ASSERT_TRUE(status.ok() || status.IsIllegalState()); |
| 193 | } |
| 194 | |
| 195 | TEST_F(ThreadPoolTest, TestExtremeScheduler) { |
| 196 | // The case is for the scenario: |