public void SaveDocument(Document document) { if (document == null) { return; } lock (syncLock) { docsProvider.SaveDocument(document); } }
public async Task SaveDocument(Document document) { if (document == null) { return; } mutex.WaitOne(); try { await docsProvider.SaveDocument(document); } finally { mutex.ReleaseMutex(); } }