rtel wrote on Monday, December 07, 2015:
Perhaps too complex for your case, but attached is a file that we use in the Windows version of the FreeRTOS+TCP demo application. The stream buffer (the code for which is also in the FreeRTOS Labs download) is the thread safe circular buffer.
In the demo you can send debug and application log messages to UDP (I think?), the console, or a disk files. The FreeRTOS threads call the logging function, and the logging function writes to the stream buffer from the context of the task. A separate Windows thread that is unknown to the FreeRTOS scheduler then reads from the stream buffer and peforms the necessary IO.
Like I said, probably too complex for your scenario, but hopefully you will get the idea.