While implementing the callback of aerospike_query_foreach, is it required to make callback threadsafe, example: callback()
std::lock_guard < std::mutex > guard(campMutex);
vectorList.emplace_back(testValue);
While implementing the callback of aerospike_query_foreach, is it required to make callback threadsafe, example: callback()
std::lock_guard < std::mutex > guard(campMutex);
vectorList.emplace_back(testValue);
Hi @vinay_negi
Yes, you need to make aerospike_query_foreach_callback thread safe, as multiple sub queries could be running and calling this callback function in parallel.
When you are using aerospike_query_foreach, query commands to each node in the cluster is run in parallel threads.
aerospike_query_foreach_callback
Multiple threads will likely be calling the callback in parallel. Therefore, your callback implementation should be thread safe.