Well, I've basically completed my project but I have one last question. I'm wondering if threads reading from the same file is affected by each other.
IF thread 1 rewinds a file with thread 2 be affected by this file rewind?
Well, I've basically completed my project but I have one last question. I'm wondering if threads reading from the same file is affected by each other.
IF thread 1 rewinds a file with thread 2 be affected by this file rewind?
Unless you see on the API a nice little comment like "this is thread safe", you generally assume that everything else is NOT thread safe.
File handles are typically owned by a process, not a thread.
So you should generally expect surprises when you go sharing file handles between threads.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I don't know what you're trying to do but couldn't you remove the possible problem by giving each thread its own file handle?
Well yea each thread create its own file handler, do they don't affect each other during runtime. I just thought it would because you cant allocate memory in the threads it will cause a SEGSIGV so I thought it would do the same with files but it doesnt