This is called outside the mutex but it is only ever called once and Future<>::AddCallback is thread-safe
| 1205 | // This is called outside the mutex but it is only ever called |
| 1206 | // once and Future<>::AddCallback is thread-safe |
| 1207 | void MarkFinalError(const Status& err, Future<T> maybe_sink) { |
| 1208 | if (maybe_sink.is_valid()) { |
| 1209 | // Someone is waiting for this error so lets mark it complete when |
| 1210 | // all the work is done |
| 1211 | all_finished.AddCallback([maybe_sink, err](const Status& status) mutable { |
| 1212 | maybe_sink.MarkFinished(err); |
| 1213 | }); |
| 1214 | } else { |
| 1215 | // No one is waiting for this error right now so it will be delivered |
| 1216 | // next. |
| 1217 | final_error = err; |
| 1218 | } |
| 1219 | } |
| 1220 | |
| 1221 | bool IsCompleteUnlocked(const util::Mutex::Guard& guard) { |
| 1222 | return outstanding_requests == 0 && |
no test coverage detected