File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -251,7 +251,6 @@ struct CachingHostAllocatorImpl {
251
251
auto * block = reinterpret_cast <B*>(ctx);
252
252
253
253
std::optional<std::vector<E>> events;
254
- ska::flat_hash_set<S> streams;
255
254
{
256
255
std::lock_guard<std::mutex> g (block->mutex_ );
257
256
block->allocated_ = false ;
@@ -260,19 +259,14 @@ struct CachingHostAllocatorImpl {
260
259
} else {
261
260
events = std::vector<E>();
262
261
events->reserve (block->streams_ .size ());
263
- block->event_count_ += block->streams_ .size ();
264
- // Move out streams to avoid holding the mutex during event recording
265
- streams = std::move (block->streams_ );
262
+ for (auto stream : block->streams_ ) {
263
+ record_stream (events, stream);
264
+ }
265
+ block->event_count_ += events->size ();
266
266
block->streams_ .clear ();
267
267
}
268
268
}
269
269
270
- // Event recording must be done outside the mutex to avoid potential
271
- // deadlocks (e.g., when Python GIL is involved)
272
- for (auto stream : streams) {
273
- record_stream (events, stream);
274
- }
275
-
276
270
if (!events) {
277
271
auto index = size_index (block->size_ );
278
272
std::lock_guard<std::mutex> g (free_list_[index].mutex_ );
You can’t perform that action at this time.
0 commit comments