Project Name File Name Usage Source Code Link
Xtall CodeCacheManager.cs Task.Factory.StartNew(() => { semaphore.Wait(); try { var result = EnsureFile(x, progressAction: (d, t) => _strategy.OnStatus("Loading", Interlocked.Add(ref count, d) / total)); return result; } finally { semaphore.Release(); } }) Link To Source File
Hermod HTTPClient.cs Task.Factory.StartNew(() => { #region Data Boolean _EndOfHTTPHeader = false; long _Length = 0; long EndOfHeaderPosition = 6; #endregion #region Client initialisieren und mit dem Server verbinden // Init TcpClient if (TCPClient == null) TCPClient = new TcpClient(this.IPAddress.ToString(), this.Port.ToInt32()); //TCPClient.ReceiveTimeout = 5000; // Open stream for reading and writting if (TCPStream == null) TCPStream = TCPClient.GetStream(); #endregion #region Send Request var _RequestBytes = (HTTPRequest.EntireRequestHeader + Environment.NewLine + Environment.NewLine).ToUTF8Bytes(); TCPStream.Write(_RequestBytes, 0, _RequestBytes.Length); var _MemoryStream = new MemoryStream(); var _Buffer = new Byte[65535]; var sw = new Stopwatch(); #endregion #region Wait for the server to react! sw.Start(); while (!TCPStream.DataAvailable || sw.ElapsedMilliseconds > 20000) Thread.Sleep(1); if (!TCPStream.DataAvailable && sw.ElapsedMilliseconds > 20000) { TCPClient.Close(); throw new ApplicationException("Could not read from the TCP stream!"); } sw.Stop(); #endregion #region Read TCPStream.ReadTimeout = 2; while (!_EndOfHTTPHeader || TCPStream.DataAvailable || !TCPClient.Connected) { #region Read the entire stream into the memory <= Rethink this someday! while (TCPStream.DataAvailable) _MemoryStream.Write(_Buffer, 0, TCPStream.Read(_Buffer, 0, _Buffer.Length)); #endregion #region Walk through the stream and search for two consecutive newlines indicating the end of the HTTP header _Length = _MemoryStream.Length; if (_Length > 4) { _MemoryStream.Seek(0, SeekOrigin.Begin); int state = 0; int _int = 0; _EndOfHTTPHeader = false; while (!_EndOfHTTPHeader || _int == -1) { _int = _MemoryStream.ReadByte(); switch (state) { case 0 : if (_int == 0x0d) state = 1; else state = 0; break; case 1 : if (_int == 0x0a) state = 2; else state = 0; break; case 2 : if (_int == 0x0d) state = 3; else state = 0; break; case 3 : if (_int == 0x0a) _EndOfHTTPHeader = true; else state = 0; break; default : state = 0; break; } } if (_EndOfHTTPHeader) break; } #endregion } if (_EndOfHTTPHeader == false) throw new ApplicationException("Could not find the end of the HTTP protocol header!"); EndOfHeaderPosition = _MemoryStream.Position - 3; #endregion #region Copy HTTP header data var HeaderBytes = new Byte[EndOfHeaderPosition - 1]; _MemoryStream.Seek(0, SeekOrigin.Begin); _MemoryStream.Read(HeaderBytes, 0, HeaderBytes.Length); #endregion var _HTTPResponse = new HTTPResponseBuilder(HeaderBytes.ToUTF8String()); #region Read 'Content-Length' bytes... // Copy only the number of bytes given within // the HTTP header element 'Content-Length'! if (_HTTPResponse.ContentLength.HasValue) { _HTTPResponse.ContentStream = new MemoryStream(); _MemoryStream.Seek(4, SeekOrigin.Current); var _Read = _MemoryStream.Read(_Buffer, 0, _Buffer.Length); var _StillToRead = (Int32) _HTTPResponse.ContentLength.Value - _Read; _HTTPResponse.ContentStream.Write(_Buffer, 0, _Read); var _CurrentBufferSize = 0; var Retries = 0; while (Retries < 10) { while (TCPStream.DataAvailable) { _CurrentBufferSize = Math.Min(_Buffer.Length, (Int32) _StillToRead); _Read = TCPStream.Read(_Buffer, 0, _CurrentBufferSize); _HTTPResponse.ContentStream.Write(_Buffer, 0, _Read); _StillToRead -= _Read; Retries = 0; } if (_StillToRead <= 0) break; Thread.Sleep(10); Retries++; } _HTTPResponse.Content = ((MemoryStream) _HTTPResponse.ContentStream).ToArray(); } #endregion #region ...or read till timeout! else { _HTTPResponse.ContentStream = new MemoryStream(); _MemoryStream.Seek(4, SeekOrigin.Current); _HTTPResponse.ContentStream.Write(_Buffer, 0, _MemoryStream.Read(_Buffer, 0, _Buffer.Length)); var Retries = 0; while (Retries < 10) { while (TCPStream.DataAvailable) { _HTTPResponse.ContentStream.Write(_Buffer, 0, TCPStream.Read(_Buffer, 0, _Buffer.Length)); Retries = 0; } Thread.Sleep(10); Retries++; } _HTTPResponse.Content = ((MemoryStream)_HTTPResponse.ContentStream).ToArray(); } #endregion #region Close connection if requested! if (_HTTPResponse.Connection == "close") { TCPClient.Close(); TCPClient = null; TCPStream = null; } #endregion #region Call HTTPResponse delegates if (HTTPResponseDelegate != null) HTTPResponseDelegate(_HTTPResponse); #endregion return this; }, TaskCreationOptions.AttachedToParent) Link To Source File
NetworkMonitor PTask.cs Task.Factory.StartNew(new TPing(l.hardwaresRow.ip_address).getTest) Link To Source File
iocwrapper IoCConcurrencyTest.cs Task.Factory.StartNew(() => { IoCContainer.Resolve(); var key = Guid.NewGuid().ToString(); IoCContainer.Register(key, new Transient()); var logger = IoCContainer.Resolve(key); var result = logger.Name; Task.Factory.StartNew(() => IoCContainer.Resolve()); return result; }) Link To Source File
iocwrapper IoCLifetimeTest.cs Task.Factory.StartNew(() => { var logger1 = IoCContainer.Resolve(); var result1 = logger1.Name; IoCContainer.Release(logger1); var logger2 = IoCContainer.Resolve(); var result2 = logger2.Name; IoCContainer.Release(logger1); Assert.AreNotEqual(result1, result2); return result1; }) Link To Source File
iocwrapper IoCLifetimeTest.cs Task.Factory.StartNew(() => { var logger1 = IoCContainer.Resolve(); var result1 = logger1.Name; IoCContainer.Release(logger1); var logger2 = IoCContainer.Resolve(); var result2 = logger2.Name; IoCContainer.Release(logger1); Assert.AreEqual(result1, result2); return result1; }) Link To Source File
iocwrapper IoCLifetimeTest.cs Task.Factory.StartNew(() => { var logger1 = IoCContainer.Resolve(); var result1 = logger1.Name; IoCContainer.Release(logger1); var logger2 = IoCContainer.Resolve(); var result2 = logger2.Name; IoCContainer.Release(logger1); Assert.AreEqual(result1, result2); return result1; }) Link To Source File
PrintChar Fake4ERepository.cs Task.Factory.StartNew(() => { throw new WebException("500 (test fake) Internal Server Error"); }) Link To Source File
PrintChar Fake4ERepository.cs Task.Factory.StartNew(() => value) Link To Source File
PrintChar ServiceFactory.cs new TaskFactory().StartNew(() => { throw new LoginFailureException(username); }) Link To Source File
PrintChar ServiceFactory.cs new TaskFactory().StartNew(() => new Fake4ERepository()) Link To Source File
PrintChar ServiceFactory.cs new TaskFactory().StartNew(() => new Dnd4ERepository(dataSource)) Link To Source File
Azyotter TwitterApiExecutor.cs Task.Factory.StartNew(action, cancellationToken.Value) Link To Source File
Azyotter TwitterApiExecutor.cs Task.Factory.StartNew(action) Link To Source File
TaskingTwLib TwitterApiExecutor.cs Task.Factory.StartNew(action, cancellationToken.Value) Link To Source File
TaskingTwLib TwitterApiExecutor.cs Task.Factory.StartNew(action) Link To Source File
Modl WorkPackage.cs Task.Factory.StartNew(() => { DoWork(); return result; }) Link To Source File
Modl StaticCache.cs Task.Factory.StartNew(() => { return Get(id, database); }) Link To Source File
somerset RunMapCommand.cs Task>.Factory.StartNew(() => IndividualBattingMap.Run(match)) Link To Source File
somerset RunMapCommand.cs Task>.Factory.StartNew(() => IndividualBowlingMap.Run(match)) Link To Source File
somerset RunMapCommand.cs Task>.Factory.StartNew(() => IndividualFieldingMap.Run(match)) Link To Source File
somerset Spider.cs Task.Factory.StartNew(() => CrawlClassification(l, l.LinkText, crawlResults.Season)) Link To Source File
somerset Spider.cs Task>.Factory.StartNew(() => CrawlLocation(l, season.Name)) Link To Source File
somerset Spider.cs Task.Factory.StartNew(() => CrawlClassification(l, l.LinkText, season)) Link To Source File
LoconetToolbox MainForm.cs Task.Factory.StartNew(VersionCheckResult.Load) Link To Source File
coapp PackageFeed.cs Task.Factory.StartNew(() => InstalledPackageFeed.Instance) Link To Source File
coapp PackageFeed.cs Task.Factory.StartNew(() => SessionPackageFeed.Instance) Link To Source File
devtools Utility.cs Task>.Factory.StartNew(() => TwitterStatus.Update(tokens, string.Format(format, args))) Link To Source File
devtools Utility.cs Task.Factory.StartNew(() => { var bitly = new UriBuilder("http", "api.bit.ly", 80, "/v3/shorten"); bitly.Query = string.Format( "format={0}&longUrl={1}&domain={2}&login={3}&apiKey={4}", "txt", Uri.EscapeDataString(uri.AbsoluteUri), "j.mp", bitlyUsername, bitlySecret); try { var request = (HttpWebRequest)WebRequest.Create(bitly.Uri); var response = request.GetResponse(); var stream = response.GetResponseStream(); var buffer = new byte[8192]; var read = stream.Read(buffer, 0, 8192); var newUrl = Encoding.UTF8.GetString(buffer, 0, read).Trim(); if (!_bitlyCache.ContainsKey(uri.AbsoluteUri)) { _bitlyCache.Add(uri.AbsoluteUri, newUrl); } return newUrl; } catch { // meh. no good. return uri.AbsolutePath; } }) Link To Source File
_toolkit_deprecated PackageFeed.cs Task.Factory.StartNew(() => InstalledPackageFeed.Instance) Link To Source File
_toolkit_deprecated PackageFeed.cs Task.Factory.StartNew(() => SessionPackageFeed.Instance) Link To Source File
fubumvc SleepController.cs Task.Factory.StartNew(() => { Thread.Sleep(1000); return new RemViewModel { Message = "Url: {0} Slept for a second on Thread {1}".ToFormat(remInput.RawUrl, Thread.CurrentThread.ManagedThreadId) }; }, TaskCreationOptions.AttachedToParent) Link To Source File
fubumvc SleepController.cs Task.Factory.StartNew(() => { Thread.Sleep(1000); return FubuContinuation.RedirectTo(); }, TaskCreationOptions.AttachedToParent) Link To Source File
fubumvc SleepController.cs Task.Factory.StartNew(() => { Thread.Sleep(1000); return new PartialSleepViewModel { Message = "Slept for a while and returned partial model on Thread {0}".ToFormat(Thread.CurrentThread.ManagedThreadId) }; }, TaskCreationOptions.AttachedToParent) Link To Source File
fubumvc AsyncContinueWithBehaviorTests.cs Task.Factory.StartNew(() => { throw new Exception("Failed!"); }) Link To Source File
fubumvc AsyncContinueWithHandlerConventionTester.cs Task.Factory.StartNew(() => new Output()) Link To Source File
fubumvc AsyncContinueWithHandlerConventionTester.cs Task.Factory.StartNew(FubuContinuation.RedirectTo) Link To Source File
fubumvc ActionInvokersTester.cs Task.Factory.StartNew(() => new Output()) Link To Source File
AwsSesWrapper.Net CommandProcessor.cs Task.Factory.StartNew(() => { using (var stream = new MemoryStream(task.Result)) { return commandResponseParser.Process(stream); } }) Link To Source File
Footloose MethodCallManager.cs Task>.Factory.StartNew(corId => { MethodCallStateData stateData; Task enqueueDataTask = null; try { stateData = methodCallsStateData.GetOrAdd(methodCall.CorrelationIdentifier, x => new MethodCallStateData { MethodResponseSignal = new ManualResetEventSlim(false) }); logger.Debug( () => string.Format("Endqueue method call with correlation identifier '{0}' to '{1}'.", methodCall.CorrelationIdentifier, service)); enqueueDataTask = originator.EnqueueData(service, methodCall, cancellationToken); enqueueDataTask.Wait(); //Wait(cancellationToken); logger.Debug( () => string.Format( "Waiting for method response with correlation identifier '{0}' from '{1}'.", methodCall.CorrelationIdentifier, service)); // waiting for method response and return stateData.MethodResponseSignal.Wait(cancellationToken); methodCallsStateData.TryGetValue(methodCall.CorrelationIdentifier, out stateData); return new MethodResponse(stateData.MethodResponse); } catch (AggregateException aggregateException) { logger.ErrorException("Exception occured:", aggregateException); throw; } catch (OperationCanceledException operationCanceledException) { if(enqueueDataTask != null && enqueueDataTask.Exception != null) { var exeption = enqueueDataTask.Exception.Flatten(); logger.ErrorException("Enqueue Data Task has thrown an Exception:", exeption); throw exeption; } if (cancellationToken.IsCancellationRequested) { logger.Debug( () => string.Format("Method Call cancelling per user request. Correlation Identifier: '{0}'.", methodCall.CorrelationIdentifier)); cancellationToken.ThrowIfCancellationRequested(); } logger.ErrorException( string.Format("Method Call canceled. Correlation Identifier: '{0}'.", methodCall.CorrelationIdentifier), operationCanceledException); throw; } finally { methodCallsStateData.TryRemove(methodCall.CorrelationIdentifier, out stateData); } }, methodCall.CorrelationIdentifier, cancellationToken) Link To Source File
Footloose MessageOriginator.cs Task.Factory.StartNew(() => TrySendMessage(response, new CancellationTokenSource())) Link To Source File
RestBugs EtagMessageHandler.cs taskFactory.StartNew(() => { Trace.WriteLine("EtagMessageHandler - Task - Conditional GET match"); var resp = new HttpResponseMessage(HttpStatusCode.NotModified); resp.Headers.ETag = new EntityTagHeaderValue(_eTagStore.Fetch(request.RequestUri)); return resp; }) Link To Source File
RestBugs EtagMessageHandler.cs taskFactory.StartNew(() => { Trace.WriteLine("EtagMessageHandler - Task - Conditional update not matched"); var resp = new HttpResponseMessage(HttpStatusCode.PreconditionFailed); resp.Headers.ETag = new EntityTagHeaderValue(_eTagStore.Fetch(request.RequestUri)); return resp; }) Link To Source File
ILSpy DecompileAllCommand.cs Task.Factory.StartNew(() => { AvalonEditTextOutput output = new AvalonEditTextOutput(); Parallel.ForEach(MainWindow.Instance.CurrentAssemblyList.GetAssemblies(), new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount, CancellationToken = ct }, delegate(LoadedAssembly asm) { if (!asm.HasLoadError) { Stopwatch w = Stopwatch.StartNew(); Exception exception = null; using (var writer = new System.IO.StreamWriter("c://temp//decompiled//" + asm.ShortName + ".cs")) { try { new CSharpLanguage().DecompileAssembly(asm, new Decompiler.PlainTextOutput(writer), new DecompilationOptions { FullDecompilation = true, CancellationToken = ct }); } catch (Exception ex) { writer.WriteLine(ex.ToString()); exception = ex; } } lock (output) { output.Write(asm.ShortName + " - " + w.Elapsed); if (exception != null) { output.Write(" - "); output.Write(exception.GetType().Name); } output.WriteLine(); } } }); return output; }) Link To Source File
Vulcan CommandHandlerTests.cs Task.Factory.StartNew( func ) Link To Source File
BinaryAnalysis.Core SchedulerInstance.cs taskFactory.StartNew((s) => { var ss = s as PersistentSchedulerTask; ss.ScriptFinished += OnScriptFinished; ss.ScriptStarted += OnScriptStarted; ss.ScriptCustomEvent += OnScriptCustomEvent; ss.TaskFinished += OnTaskFinished; ss.TaskStarted += OnTaskStarted; log.Debug("Starting: " + ss); ss.Execute(container); return ss; },schedule) Link To Source File
Par2NET MD5TasksHelper.cs Task.Factory.StartNew((str) => { MD5 md5Hasher = MD5.Create(); using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read)) { return md5Hasher.ComputeHash(fs); } }, filename) Link To Source File
learning Program.cs Task.Factory.StartNew(() => { Thread.Sleep(2000); return 42; }) Link To Source File
learning Program.cs Task.Factory.StartNew(() => { Thread.Sleep(2000); return 42; }) Link To Source File
MSTest MessageProcessorWithParallel.cs Task>.Factory.StartNew(() => toDispatch.AsParallel().WithDegreeOfParallelism(threadsCount).SelectMany(ProcessPackage).ToList()) Link To Source File
MSTest MessageProcessorWithMsBlockingQueue.cs Task>.Factory.StartNew(olo.ToList) Link To Source File
NewsService NewsService.cs Task>.Factory.StartNew(() => NewsStreamBuilder(feedValue)) Link To Source File
NewsService NewsService.cs Task.Factory.StartNew(() => NewModelBuilder(feedValue, count)) Link To Source File
NewsService NewsService.cs Task.Factory.StartNew(() => NewsFeatureBuilder(feedValue, count)) Link To Source File
Fuzz AlgorithmBase.cs Task.Factory .StartNew(ProcessData) Link To Source File
Fuzz ProcessingWindow.cs Task.Factory.StartNew(() => this.system.ProcessImage(resizedSource, observerData, processingMethod)) Link To Source File
OG-DotNet MemoizerTest.cs Task.Factory.StartNew(() => m.Get(arg)) Link To Source File
OG-DotNet MemoizerTest.cs Task.Factory.StartNew(() => m.Get(arg)) Link To Source File
coapp CoTaskFactory.cs StartNew(function, Tasklet.CurrentCancellationToken, CreationOptions, Scheduler, new[] { messageHandlers }) Link To Source File
coapp CoTaskFactory.cs StartNew(function, Tasklet.CurrentCancellationToken, creationOptions, Scheduler, new[] { messageHandlers }) Link To Source File
coapp CoTaskFactory.cs StartNew(function, cancellationToken, CreationOptions, Scheduler, new[] { messageHandlers }) Link To Source File
coapp CoTaskFactory.cs StartNew(function, cancellationToken, creationOptions, scheduler, new[] { messageHandlers }) Link To Source File
coapp CoTaskFactory.cs StartNew(function, state, Tasklet.CurrentCancellationToken, CreationOptions, Scheduler, new[] { messageHandlers }) Link To Source File
coapp CoTaskFactory.cs StartNew(function, state, Tasklet.CurrentCancellationToken, creationOptions, Scheduler, new[] { messageHandlers }) Link To Source File
coapp CoTaskFactory.cs StartNew(function, state, cancellationToken, CreationOptions, Scheduler, new[] { messageHandlers }) Link To Source File
coapp CoTaskFactory.cs StartNew(function, state, cancellationToken, creationOptions, scheduler, new[] { messageHandlers }) Link To Source File
Idol.net QueryWithParametrics.cs Task.Factory.StartNew(base.Execute) Link To Source File
Idol.net QueryWithParametrics.cs Task.Factory.StartNew(parametrics.Execute) Link To Source File
WoW-Community-Platform-API MainForm.cs Task.Factory.StartNew(() => m_client.GetRealmStatus()) Link To Source File
torshify-r4dio TrackDJSetupViewModel.cs Task>.Factory .StartNew(MoodRadioStationViewModel.GetAvailableMoods) Link To Source File
torshify-r4dio TrackDJSetupViewModel.cs Task>.Factory .StartNew(StyleRadioStationViewModel.GetAvailableStyles) Link To Source File
torshify-r4dio MoodRadioStationViewModel.cs Task>.Factory .StartNew(GetAvailableMoods) Link To Source File
torshify-r4dio SimilarArtistsRadioStationViewModel.cs Task>.Factory .StartNew(() => { IsLoading = true; using (EchoNestSession session = new EchoNestSession(EchoNestConstants.ApiKey)) { SimilarArtistsArgument arg = new SimilarArtistsArgument(); arg.Name = searchPhrase; arg.Results = 20; arg.Bucket = ArtistBucket.Images | ArtistBucket.Terms; var response = session .Query() .Execute(arg); if (response.Status.Code == ResponseCode.Success) { return response.Artists; } } return new ArtistBucketItem[0]; }) Link To Source File
torshify-r4dio StyleRadioStationViewModel.cs Task>.Factory .StartNew(GetAvailableStyles) Link To Source File
MadCow Irc.cs Task.Factory.StartNew(() => Connect(Server, 6667)) Link To Source File
MadCow UpdaterProcedure.cs Task.Factory.StartNew(() => Helper.CopyDirectory(Path.GetTempPath() + @"/MadCow/NewMadCow/bin/MadCowDebug/", madCowPath.ToString(), true)) Link To Source File
MadCow UpdaterProcedure.cs Task.Factory.StartNew(() => CompileMadcow(madcowPath)) Link To Source File