Author Topic: UTFAT_MANAGED_MODE  (Read 3584 times)

Offline neil

  • Sr. Member
  • ****
  • Posts: 433
    • View Profile
« on: June 12, 2014, 11:54:11 AM »
Hi Mark,
   I have 4 file handles opening the same file, 2 write and 2 read. Do I set the UTFAT_MANAGED_MODE on ALL file handles or just the read?

At present I set only the files open for read to UTFAT_OPEN_FOR_READ | UTFAT_MANAGED_MODE , but want to make sure all file handles will be updated.

Best Regards

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3187
    • View Profile
    • uTasker
« Reply #1 on: June 12, 2014, 06:36:50 PM »
Hi Neil

Each time a file is written to all file handles on that file will be updated as long as they are operating in managed mode.
This means that files opened in managed mode will be updated by any writes to a file, irrespective of whether the write was performed in managed mode or not.

In your case it means that the 2 read handles opened in managed mode will be 'synchronised' each time the file that they are working with is modified - the two write handles can be used without managed mode to still cause the read files (using the same file object) to be updated.

If you have two handles writing to the same file it may be an idea to also open them in managed mode so that they each know when the other handle has written - if not they may overwrite the same file location and cause changes from the other handle's write to be lost. Usually managed mode is used on writes to ensure than there is only one handle writing a file to ensure that there are no such problems -  however this depends on the application, which can also ensure this itself.