File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -263,15 +263,18 @@ external synchronization.
263263One-shot functions (``xxh32_digest ``, ``xxh64_hexdigest ``, ``xxh3_128_digest ``,
264264etc.) are stateless and always safe to call concurrently.
265265
266- If you need to share a streaming hash object across threads, use the
266+ Concurrent ``update() `` / ``reset() `` on a shared streaming hash object is
267+ discouraged even with locking — prefer one-shot functions or per-thread hash
268+ objects. If you must share a streaming hash across threads, use the
267269``xxhash.threadsafe `` submodule. It provides the same API with a per-object
268- lock that protects all access to the internal xxHash state:
270+ lock that serializes all access to the internal xxHash state:
269271
270272.. code-block :: python
271273
272274 >> > from xxhash import threadsafe
273275 >> > h = threadsafe.xxh64()
274- >> > # h can now be safely updated from multiple threads
276+ >> > # h can be updated from multiple threads, but concurrent update/reset
277+ >> > # still adds overhead and is not recommended
275278
276279 The same two-module split is provided on free-threading (no-GIL) Python
277280builds: the default module is unlocked, and ``xxhash.threadsafe `` provides a
You can’t perform that action at this time.
0 commit comments