3

Is WriteFile thread safe? I mean,can I write the same file from multiple threads simultaneously without synchronization? MSDN says nothing about thread safety of WriteFile.

tshepang
  • 12,111
  • 21
  • 91
  • 136

1 Answers1

3

Yes it is thread safe by its own, i.e it prevents system from crashing, win API maintain internal locking when writing files and that lock is byte-range locks. You can read more here File locking

Sasha
  • 3,599
  • 1
  • 31
  • 52
Nasir Mahmood
  • 1,445
  • 1
  • 13
  • 18