I have a multi-threaded application and I would like each thread to be able to output information to the same text file. I'm unsure how to do this in a thread safe manner.
I have considered creating a routine that would check to see if the file is locked.
If it is locked,it would loop until it is not, then write data, unlock, and close the file.
I would thread this routine each time it is called.
Is this the most efficient way to do this? Would it be thread safe? I'd appriciate any help from some people more familiar with multi threaded apps than I am!