Closed psobot closed 5 months ago
@psobot So I should remove https://github.com/spotify/voyager/pull/35 since it calls index the old way, and put in another one once this one is merged?
No need, @samek - if your PR gets merged first, I'll update this one (as it'll fail to compile), and vice versa.
@psobot is there a good way to test this to ensure that it's working as expected?
@markkohdev test added!
This PR adds a somewhat clever solution to give us a bit more thread safety around our JNI bindings to Voyager's C++ code: instead of storing a raw pointer on the Java object, we now store a pointer to a
std::shared_ptr
, which gives us thread-safe destruction and ensures that the underlying C++ object doesn't get destroyed while another Java thread might still be using it.