LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing a file for reading or writing

Hi.

I have created in my application 2 threads: one for writing a text file and one for reading the same file. Normally this two operations can't appear at the same time, but analyzing more careful the problem I concluded that this process may appear. Now I need to know if I begin an operation (writing or reading) the second operation waits the first one to be finished?

Thanks.
0 Kudos
Message 1 of 2
(2,907 Views)
I would have thought this would lead to problems of some sort. Use a thread-lock around your read and write code to make sure you don't do both at the same time. These are queued and honoured in order so each thread will only be held up as long as the read or write routine takes to complete.

Jamie
Message 2 of 2
(2,902 Views)