I am new to C++. I got a project. It is a multi threading application. In this case my part is develop a log file creating library. I got some experience with file writing using single application. But in this case it's not proper. Because in this case their are many threads. many threads need to write the information on to same file. Other programmers need to write into the same log file from anywhere of the application.Please give me a solution for this problem.
One solution would be a global shared read/write queue that in turn drives a single fstream instance? You certainly wouldn't want the fstream to be directly accessible. Even with locks and mutexes available I can see that getting complicated quickly. I have never really had to deal with multithreaded container access though so I'll leave that to others.