C++ Templates · Concurrency

Concurrency

8122c932

Ask your coding agent about this page, or add the docs server to it

curl -s 'https://www.unum.cloud/docs/usearch/templates/concurrency.md' | claude -p "How would this fit my code?"

§ Concurrent Calls

The leading template parameter of insert and search is the caller’s synchronization contract:

  • concurrent_k, the default, admits any mix of readers and writers.
  • immutable_k certifies no live mutators, so searches read neighbor lists without locks.
  • exclusive_k certifies sole ownership, compiling every lock out for single-threaded builds.

A violated certification answers contended_k instead of returning a silently wrong result. save, load, clear and health never run concurrently with inserts, while reserve runs at any time.