This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

filesystem accessed by multiple threads

Hi All,

I'm developing an application with keil RTX and STM32F4.
One thread collect events on a log file. I manage the files with fopen, fwrite, fdelete, ....

Another thread manages the network interface. With the FTP server I can download files to my PC.

I would like that one thread at a time accesses to the log file, in order to avoid read or write errors, due to simultaneous access.

Could anyone suggest me how to do?

Many thanks in advance.

Davide

Parents
  • Note the __weak keyword before the ftp file functions - you can supply your own functions if you like, and the linker will then pick up your code instead of the weak functions in the library.

    In the end, you don't want the log file to be constantly opened/closed when you add log lines (unless you add log lines very seldomly) to avoid the wear of constantly having to not just write the new log data but also updating the information about how large the file is etc.

Reply
  • Note the __weak keyword before the ftp file functions - you can supply your own functions if you like, and the linker will then pick up your code instead of the weak functions in the library.

    In the end, you don't want the log file to be constantly opened/closed when you add log lines (unless you add log lines very seldomly) to avoid the wear of constantly having to not just write the new log data but also updating the information about how large the file is etc.

Children
No data