Revision 6a8aa833

b/trunk/Pithos.Core/Agents/AsyncManualResetEvent.cs
39 39
            _tcs.Task.Wait();
40 40
        }
41 41

  
42
        public void Set() { _tcs.TrySetResult(true); }
42
        public void Set()
43
        {
44
            var tcs = _tcs;
45
            Task.Factory.StartNew(s => ((TaskCompletionSource<bool>)s).TrySetResult(true),
46
                tcs, CancellationToken.None, TaskCreationOptions.PreferFairness, TaskScheduler.Default);
47
            tcs.Task.Wait(); 
48
        }
43 49

  
44 50
        public void Reset()
45 51
        {
b/trunk/Pithos.Core/Agents/NetworkAgent.cs
343 343
        //Remote files are polled periodically. Any changes are processed
344 344
        public async Task PollRemoteFiles(DateTime? since = null)
345 345
        {
346
            Debug.Assert(Thread.CurrentThread.IsBackground,"Polling Ended up in the main thread!");
347

  
346 348
            UpdateStatus(PithosStatus.Syncing);
347 349
            StatusNotification.Notify(new PollNotification());
348 350

  

Also available in: Unified diff