@@ -15,15 +15,17 @@ NumPy releases the GIL for many low-level operations, threads that spend most of
1515the time in low-level code will run in parallel.
1616
1717It is possible to share NumPy arrays between threads, but extreme care must be
18- taken to avoid creating thread safety issues when mutating shared arrays. If
19- two threads simultaneously read from and write to the same array, at best they
20- will see inconsistent views of the same array data. It is also possible to crash
21- the Python interpreter by, for example, resizing an array while another thread
22- is reading from it to compute a ufunc operation.
23-
24- In the future, we may add locking to ndarray to make working with shared NumPy
25- arrays easier, but for now we suggest focusing on read-only access of arrays
26- that are shared between threads.
18+ taken to avoid creating thread safety issues when mutating arrays that are
19+ shared between multiple threads. If two threads simultaneously read from and
20+ write to the same array, they will at best produce inconsistent, racey results that
21+ are not reproducible, let alone correct. It is also possible to crash the Python
22+ interpreter by, for example, resizing an array while another thread is reading
23+ from it to compute a ufunc operation.
24+
25+ In the future, we may add locking to ndarray to make writing multithreaded
26+ algorithms using NumPy arrays safer, but for now we suggest focusing on
27+ read-only access of arrays that are shared between threads, or adding your own
28+ locking if you need to mutation and multithreading.
2729
2830Note that operations that *do not * release the GIL will see no performance gains
2931from use of the `threading ` module, and instead might be better served with
0 commit comments