LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Keep the thread of the fist execution of a DLL for next calls

Hello everybody,

 

I'm developing a driver for mongodb in top of mongo c driver. The question is that the mongo c driver isn't thread safe, so I should execute it in the UI thread, which isn't convinient.

 

I have found posts about how to limit the number of threads in some "execution system" (like other 1 or other 2), and then wrap the DLLs in subVIs that execute in the modified execution system. But that sounds a little bit tricky. You have to configure each Labview instance & executable where you want to execute the driver. And there isn't room for multithreading.

 

There is a way to, during runtime, keep the thread of the fist execution of the DLL and then use it for the next calls?

 

Thanks for your time, best regards,

 

 

EMCCi

0 Kudos
Message 1 of 3
(2,050 Views)

Hello everybody,

 

I have a DLL (mongo-c-driver) that has functions like this that asks for the address of a uninitialized variable: "child MUST be an uninitialized bson_t to avoid leaking memory."

 

In a tutorial is used like this:

 

bson_t      child;
bson_append_document_begin (..., &child)

How I can  reproduce this in labview?

 

Thanks for your time,

 

 

EMCCi

0 Kudos
Message 2 of 3
(2,041 Views)

@EMCCi wrote:

There is a way to, during runtime, keep the thread of the fist execution of the DLL and then use it for the next calls?


 

I don't think there is a way to do that.

 

I'd look at C\C++\OS ways to do this. For instance, pass a pointer to class with a mutex and a conditional variable, and pass it along the parameters to each function...

 

See how-to-make-a-c-wrapper-api-thread-safe.

0 Kudos
Message 3 of 3
(2,041 Views)