MongoDB C Driver concurrent bulk execute and other operations on same collection

with MongoDB C Driver is it possibile to run concurrent bulk execute and other operations on same collection (collection/client from pool) from different threads ?
it doesn’t seem possibile to do mongoc_collection_find_with_opts and a mongoc_bulk_operation_execute concurrently, I need to separate them with a critical section (on windows), or use different collections

also to clarify should one call mongoc_collection_create_bulk_operation_with_opts from the thread that created the collection ? it seems to allow asynchronous execution of the bulk in another thread, (it seems not to care if bulk created in the collection allocator thread or in the executor thread) in case any possible clues ?

I got interested in the newest 1.20 driver upon reading pooled clients concurrency improved"C%20Driver"%20and%20fixVersion%3D"1.20.0"

I enclose modifications for visual studio 2008, which is still supported by current cmake and version 1.19 compiles with vs 2008, in case you could possibly use #defines or other system to allow legacy windows visual studio ? the changes are flagged with “VS2008_PROBLEM”

(unfortunately cmake sets absolute pathname C:\temp\mongo-c-driver-1.20.0)
that said, I modified in particular an example “example-update” (unfortunately it is .cpp in order to use a deque queue of bulks) to illustrate the afore mentioned concepts, in case that bulk execution from another thread (it seems to work with say 2 bulk executor threads ?) is intended, perhaps you could put such an example of say asynchronous bulk execution ? in order to specify what is allowed/intentional and what not to do

Another subtlety in case anyone has a clue : concurrent different threads, each executing a bulk obtained from their own client/collection, cannot call mongoc_collection_create_bulk_operation_with_opts concurrently with mongoc_bulk_operation_execute, I am only observing empirically what works and what won’t I haven’t looked into the sources much.

Hello @Guglielmo_Fanini,

mongoc_client_t and mongoc_collection_t are not thread-safe.

To use the C driver in a multi-threaded application, each thread should have a separate mongoc_client_t obtained from a mongoc_client_pool_t. See Connection Pooling — libmongoc 1.20.0 for more information.

I have deleted the comment on CDRIVER-4002. The Jira project is for bug reports and feature requests.
If you have found a bug, please file a new CDRIVER ticket.