Пример #1
0
        public async Task PushChangesAsync(CancellationToken cancellationToken)
        {
            await processingSemaphore.WaitAsync(cancellationToken);

            try
            {
                while (this.operationsQueue.Count > 0)
                {
                    IMobileServiceFileOperation operation = await operationsQueue.PeekAsync();

                    // This would also take the cancellation token
                    await operation.Execute(this.metadataStore, this);

                    await operationsQueue.RemoveAsync(operation.Id);
                }
            }
            finally
            {
                processingSemaphore.Release();
            }
        }