示例#1
0
        protected HeapRecording(
            TaskScheduler scheduler,
            ActivityIndicator activities,
            IEnumerable <string> snapshots
            )
        {
            Scheduler  = scheduler;
            Activities = activities;

            Futures.Add(Scheduler.Start(
                            LoadExistingMainTask(), TaskExecutionPolicy.RunAsBackgroundTask
                            ));

            SnapshotLoadQueue.EnqueueMultiple(snapshots);

            DiffCache.ItemEvicted += DiffCache_ItemEvicted;
        }
示例#2
0
        protected IEnumerator <object> SendTask()
        {
            var sleep = new Sleep(SendInterval);

            Dictionary <string, object> prefs = new Dictionary <string, object>();

            yield return(Preferences.GetAll().Bind(() => prefs));

            List <string> allItems = new List <string>();

            var oldQueue = Queue;

            Queue = new BlockingQueue <string>();
            if (oldQueue != null)
            {
                Queue.EnqueueMultiple(oldQueue.DequeueAll());
            }

            while (true)
            {
                var nextItem = Queue.Dequeue();

                using (nextItem)
                    yield return(nextItem);

                yield return(sleep);

                allItems.Clear();
                allItems.Add(nextItem.Result);
                allItems.AddRange(Queue.DequeueAll());

                yield return(new Start(
                                 Send(prefs, allItems.ToArray()), TaskExecutionPolicy.RunAsBackgroundTask
                                 ));
            }
        }
        protected IEnumerator<object> SendTask()
        {
            var sleep = new Sleep(SendInterval);

            Dictionary<string, object> prefs = new Dictionary<string, object>();
            yield return Preferences.GetAll().Bind(() => prefs);

            List<string> allItems = new List<string>();

            var oldQueue = Queue;
            Queue = new BlockingQueue<string>();
            if (oldQueue != null)
                Queue.EnqueueMultiple(oldQueue.DequeueAll());

            while (true) {
                var nextItem = Queue.Dequeue();

                using (nextItem)
                    yield return nextItem;

                yield return sleep;

                allItems.Clear();
                allItems.Add(nextItem.Result);
                allItems.AddRange(Queue.DequeueAll());

                yield return new Start(
                    Send(prefs, allItems.ToArray()), TaskExecutionPolicy.RunAsBackgroundTask
                );
            }
        }