When adding a point to an index without providing an id, we rely on TypedIndex::currentLabel to get one. But we are not doing it in a threadsafe way. This PR fixes that, solves #65
Changes Made
C++
TypedIndex::currentLabel is now std::atomic and it's post-incremented atomically to get a new id when needed
Testing
Checklist
[x] My code follows the code style of this project.
[x] I have added and/or updated appropriate documentation (if applicable).
[x] All new and existing tests pass locally with these changes.
[x] I have run static code analysis (if available) and resolved any issues.
[x] I have considered backward compatibility (if applicable).
[x] I have confirmed that this PR does not introduce any security vulnerabilities.
Description
When adding a point to an index without providing an id, we rely on
TypedIndex::currentLabel
to get one. But we are not doing it in a threadsafe way. This PR fixes that, solves #65Changes Made
C++
TypedIndex::currentLabel
is nowstd::atomic
and it's post-incremented atomically to get a new id when neededTesting
Checklist
Additional Comments