I want to use ReaderWriterLock in this function:
static async void ETDGazeDataEvent(ETMWNet.ETGazeDataType pGazeData)
{
StorageFolder ETfolder = ApplicationData.Current.LocalFolder;
StorageFile file = await ETfolder.CreateFileAsync("Log.ETDGazeDataEvent.txt", CreationCollisionOption.OpenIfExists);
String ETAnswer = pGazeData.FrameNum + " Time: " + pGazeData.TimeStamp + " X: " + pGazeData.Left.GazePointPixels.x + " Y: " + pGazeData.Left.GazePointPixels.y + " \r\n";
await Windows.Storage.FileIO.AppendTextAsync(file, ETAnswer);
}
This function called 30 times in second, and each time the function write data to text file. I want to add code that lock the function until it finish to write the sampled data every time. which code I need to add so it work well on vs2013 c# xaml?