appsignal / mongo-rust-driver

Mongo Rust driver built on top of the Mongo C driver
Apache License 2.0
89 stars 22 forks source link

Trying to pass between threads #49

Closed goriunov closed 3 years ago

goriunov commented 6 years ago

When i am trying to clone pool and pass it to another thread i am getting this error:

*mut mongoc_sys::bindings::mongoc_client_t` cannot be sent between threads safely

what would you suggest to properly pass pool to another thread ?

thijsc commented 6 years ago

What are you trying to do here? Do you have code illustrating the issue?

gngeorgiev commented 5 years ago

@goriunov You should get a new client in each new thread from the ClientPool by using pop. The ClientPool is what you should be sharing between threads. http://mongoc.org/libmongoc/1.12.0/mongoc_client_pool_t.html