LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

*.ini file access in CVI from multi-thread TestStand application

I would like to use the ini file functions in CVI, but the documentation indicates that it is not multi-thread safe. I am calling the CVI routine from TestStand which will have multiple threads going in the batch test mode. Can I put a lock on the CVI function call in TestStand and still use the ini file functions. (ex: Ini_GetPointerToString)? I only need to read the information in the ini file, I would not be changing any values during the multi-thread operation from TestStand.
0 Kudos
Message 1 of 4
(2,924 Views)
It should work fine as long as you are locking other threads from doing any file I/O. As long as you wrap the INI calls in a thread lock, it should work fine.

Best Regards,

Chris Matthews
National Instruments
Message 2 of 4
(2,924 Views)
I will be sure and run the Ini_ReadFromFile in a single thread, what about the other functions once the information is in memory. I will only be reading values using functions like Ini_GetInt() and Ini_GetStringCopy(). Do these need to be ran in a single thread only?

Thanks for your help,
Scott Trosper
0 Kudos
Message 3 of 4
(2,924 Views)
To be safe, yes. I would have to dive into the code to make sure it was necessary (which you can do as well since the code is provided). What it means when it says this library isn't thread safe is that any globals, file access, etc. are not protected with synchronization objects to prevent simultaneous access. There could be globals inside this library that you would need to protect and therefore should only use the Ini functions from one thread at a time using thread locking, or one thread only.

Chris
0 Kudos
Message 4 of 4
(2,924 Views)