| 346 | } |
| 347 | |
| 348 | void RequestContext::CancelAndMarkInactive() { |
| 349 | Cancel(); |
| 350 | |
| 351 | unique_lock<mutex> l(lock_); |
| 352 | DCHECK_NE(state_, Inactive); |
| 353 | DCHECK(Validate()) << endl << DebugString(); |
| 354 | |
| 355 | // Wait until the ranges finish up. |
| 356 | while (num_disks_with_ranges_ > 0) disks_complete_cond_var_.Wait(l); |
| 357 | |
| 358 | // Validate that no ranges are active. |
| 359 | DCHECK_EQ(0, active_scan_ranges_.size()) << endl << DebugString(); |
| 360 | |
| 361 | // Validate that no threads are active and the context is not queued. |
| 362 | for (const PerDiskState& disk_state : disk_states_) { |
| 363 | DCHECK_EQ(0, disk_state.in_flight_ranges()->size()) << endl << DebugString(); |
| 364 | DCHECK_EQ(0, disk_state.unstarted_scan_ranges()->size()) << endl << DebugString(); |
| 365 | DCHECK_EQ(0, disk_state.num_threads_in_op()) << endl << DebugString(); |
| 366 | DCHECK(!disk_state.is_on_queue()) << endl << DebugString(); |
| 367 | } |
| 368 | DCHECK(Validate()) << endl << DebugString(); |
| 369 | state_ = Inactive; |
| 370 | } |
| 371 | |
| 372 | void RequestContext::AddRangeToDisk(const unique_lock<mutex>& lock, |
| 373 | RequestRange* range, ScheduleMode schedule_mode) { |
no test coverage detected