| 28 | namespace nvimgcodec { |
| 29 | |
| 30 | void ProcessingResultsPromise::set(int index, ProcessingResult res) { |
| 31 | if (is_set_[index].exchange(true)) |
| 32 | throw std::runtime_error("Processing results for sample " + std::to_string(index) + " was already set."); |
| 33 | results_[index] = res.status_; |
| 34 | if (pending_.fetch_sub(1) == 1) { // last one |
| 35 | is_all_set_.store(true); |
| 36 | promise_impl_.set_value(results_); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | void ProcessingResultsPromise::set(const std::vector<std::pair<int, nvimgcodecProcessingStatus_t>>& results) { |
| 41 | if (results.empty()) { |
no test coverage detected