LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ini file data deleted

I'm using the configuration file VIs to read and write data in an ini file. I have only one file that writes key values; the rest only read. Twice in the last two months, the data in the file has been inexplicably deleted. Has anybody had this experience?
0 Kudos
Message 1 of 5
(3,685 Views)
I had this with a multi threaded application.

One thread was responsible for the configuration data. It read the config file and maintained the configuration data. This thread gets commands over a queue. The last command this thread received was "End". Then the thread called "Config File Close" with "Write File" set to true. In this VI the config file was opened again with replace. At this time the file is existent but empty. When LV or the OS now switched threads and the main thread was running it could happen that it is run through "Exit LabVIEW". Now the applicatin is gone and the file is empty.

I solved this by sending an answer after "Config File Close" returned and the main thread waited for the answer befor calling "Exit labVIEW".
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
0 Kudos
Message 2 of 5
(3,661 Views)
Waldemar:

Thanks for the help. I'm not sure I completely understand your situation, but it sounds like you have set the "create file if necessary" option to true, so if a thread has the file locked, and another tries to access it, it overwrites it. Or did I miss your point?

Whenever I am accessing my file, I'm setting the "create file if necessary" option to false, so presumably it will not get overwritten.

My application is also multithreaded, so maybe my problem is still similar to yours. Can you explain what you mean by "sending an answer?"

Thanks again!

Mike
0 Kudos
Message 3 of 5
(3,654 Views)
Hi Mike,

I often use a multi threaded software architecture. Think of two VIs named Main.vi and Config.vi. Main.vi is the top level VI and will load and run Config.vi through VI Server. One way to communicate between those threads is using queues. Each VI creates a receiver queue which is named as the thread. In this example Main.vi will create a queue named "Main" and Config.vi will create a queue named "Config". When the app is going to stop Main.vi will crete a queue named "Config" and will send the message "END" to it. Config.vi will read this message and will do the action related to this message. Done with it, it creates a queue named "Main" and sends "DONE" to it. Main.vi will read this messsage and will stop execution or exit. Sending "DONE" is what I ment with "Sending an answer".
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
0 Kudos
Message 4 of 5
(3,630 Views)

Hi Waldemar

I now also had this problem several times, but no multiple threads accessing the same file. I read it once at the beginning of the program and out of a sudden it is empty and causes the program to crash, although I don't read it anymore.

Any ideas?

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 5 of 5
(3,449 Views)