We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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
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.