C
Curious
Here's the question - I've created a program that has multiple
threads. Some threads use the same file. In order to avoid memory
corruption when multiple threads access the same file, I use a "lock"
around that block of code so only a single thread can access the file
at the same time.
Someone asked me if there is a better way to handle this than using
"lock", I don't know what to say. Any suggestion?
threads. Some threads use the same file. In order to avoid memory
corruption when multiple threads access the same file, I use a "lock"
around that block of code so only a single thread can access the file
at the same time.
Someone asked me if there is a better way to handle this than using
"lock", I don't know what to say. Any suggestion?