| 64 | } |
| 65 | |
| 66 | Stream new_stream(Device d) { |
| 67 | auto& [streams, mtx] = all_streams(); |
| 68 | std::unique_lock lock(mtx); |
| 69 | int index = streams.size(); |
| 70 | auto& s = streams.emplace_back(index, d); |
| 71 | if (d == Device::gpu) { |
| 72 | gpu::new_stream(s); |
| 73 | } |
| 74 | return s; |
| 75 | } |
| 76 | |
| 77 | ThreadLocalStream new_thread_local_stream(Device d) { |
| 78 | auto& [streams, mtx] = thread_local_streams(); |