File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -445,7 +445,9 @@ cdef class _DefaultDeviceCache:
445445 def __copy__ (self ):
446446 cdef _DefaultDeviceCache _copy = _DefaultDeviceCache.__new__ (
447447 _DefaultDeviceCache)
448- _copy._update_map(self .__device_map__)
448+ # lock must be held to avoid race conditions on map state
449+ with self ._cache_lock:
450+ _copy._update_map(self .__device_map__.copy())
449451 return _copy
450452
451453
Original file line number Diff line number Diff line change @@ -73,7 +73,9 @@ cdef class _DeviceDefaultQueueCache:
7373 cdef _DeviceDefaultQueueCache _copy = _DeviceDefaultQueueCache.__new__ (
7474 _DeviceDefaultQueueCache
7575 )
76- _copy._update_map(self .__device_queue_map__)
76+ # lock must be held to avoid race conditions on map state
77+ with self ._cache_lock:
78+ _copy._update_map(self .__device_queue_map__.copy())
7779 return _copy
7880
7981
You can’t perform that action at this time.
0 commit comments