16
votes
5answers
489 views

Are you using Parallel Extensions? [closed]

I hope this is not a misuse of stackoverflow; recently I've seen some great questions here on Parallel Extensions, and it got my interest piqued. My question: Are you using Parallel Extensions, and ...
14
votes
2answers
7k views

How to create an async method in C# 4 according to the best practices?

Consider the following code snippet: public static Task<string> FetchAsync() { string url = "http://www.example.com", message = "Hello World!"; var request = ...
12
votes
1answer
2k views

Waiting on a Task with a OnlyOnFaulted Continuation causes an AggregateException

I have some simple code as a repro: var taskTest = Task.Factory.StartNew(() => { System.Threading.Thread.Sleep(5000); }).ContinueWith((Task t) => { Console.WriteLine("ERR"); }, ...
9
votes
3answers
2k views

Why do we need ContinueWith method?

Why do we need Task.ContinueWith() method. Cannot we just write that "continuation code" inside Task body?
8
votes
3answers
2k views

Different summation results with Parallel.ForEach

I have a foreach loop that I am parallelizing and I noticed something odd. The code looks like double sum = 0.0; Parallel.ForEach(myCollection, arg => { sum += ComplicatedFunction(arg); }); ...
7
votes
1answer
2k views

ContinueWhenAll doesn't wait for all task to complete

I have found a peace of code on the web and have modified it a bit to see how it works, but now I have a problem with ContinueWhenALl as it doesn't wait for all tasks to be finished ...
5
votes
4answers
3k views

Is Wait() necessary after using C# 4.0 Task.Factory.StartNew()?

Almost all documentation that I have seen on using the C# 4.0 Task.Factory.StartNew states that in order to wait for the Task to complete, you need a Wait. But my initial testing shows that it is ...
5
votes
3answers
185 views

Why do these tasks execute sequentially?

Why does the following code execute sequentially? List<Task> tasks = new List<Task>(); for (int i = 0; i <= max; i += block) { if (i + block >= max) ...
4
votes
1answer
155 views

D taskpool wait untill all tasks are done

This is in relation to my previous question: D concurrent writing to buffer Say you have a piece of code that consists of 2 consecutive code blocks A and B, where B depends on A. This is very common ...
4
votes
1answer
436 views

any special reference needed for c# 4.0 Parallel.For?

I am following this article: http://blogs.msdn.com/b/csharpfaq/archive/2010/06/01/parallel-programming-in-net-framework-4-getting-started.aspx and in my console app Parallel namespace is visible, but ...
4
votes
3answers
3k views

Killing a deadlocked Task in .NET 4 TPL

I'd like to start using the Task Parallel Library, as this is the recommended framework going forward for performing asynchronous operations. One thing I haven't been able to find is any means of ...
3
votes
1answer
181 views

Task-Based Parallelism in D [closed]

Does the programming language D support task-based parallelism in any way, either natively or through some API?
3
votes
2answers
2k views

.NET Framework 4.0: Chaining tasks in a loop

I want to chain multiple Tasks, so that when one ends the next one starts. I know I can do this using ContinueWith. But what if I have a large number of tasks, so that: t1 continues with t2 ...
3
votes
3answers
85 views

How to stop all tasks when one is finished in c#

I have different tasks to read from different files and find a word into them. I have put them into a task array which I start with waitAny method as following : foreach (string file in filesList) ...
3
votes
1answer
213 views

When is the System.Threading.Task useful?

I have used most of the Threading library extensively. I am fairly familiar with creating new Threads, creating BackgroundWorkers and using the built-in .NET ThreadPool (which are all very cool). ...
3
votes
4answers
170 views

Handle Exceptions with tasks

Say that I have code like this: serviceCallFinished = false; Task.Factory.StartNew(() => { response = ServiceManager.GeneralService.ServiceMethod(loginName, password); ...
3
votes
1answer
798 views

Segmentation fault when accessing a instance variable (implicit firstprivate) through Openmp task

This question is specific to the task construct in OpenMP 3.0 and its use of implicit firstprivate for C++. I am looking for an explanation of the problem and also possible solutions. I had some ...
2
votes
2answers
249 views

Creating procedure or function in Ada task

I am creating the following task in Ada and I want it to contain a procedure that tells me the count of my buffer. How can I do that? package body Buffer is task body Buffer is size: constant ...
2
votes
2answers
507 views

Blocking with Task?

I try to use tasks in my application like this : Task test; test = Task.Factory.StartNew(() => general.Login(loginName, password)); MyTextBox.Text = "test text"; It will be the UI thread that ...
2
votes
2answers
633 views

how to run multiple tasks in C#?

How to modify the following code and make it runs multiple tasks concurrently? foreach (SyndicationItem item in CurrentFeed.Items) { if (m_bDownloadInterrupted) break; await Task.Run( ...
2
votes
2answers
197 views

OpenMP tasks and Thread creation

I want to get IDs of different threads in an OpenMP program (C code in Linux). Why I get the same thread ID for the below code? #pragma omp task untied id1 = omp_get_thread_num(); ...
2
votes
1answer
526 views

.NET Task Parallel Library

I have read documenation and many tutorials on TPL but none covers model I want to achieve. There were always fixed number of iterations for some algorithm. I need constantly running threads (as ...
2
votes
1answer
74 views

How to run dependent Tasks parallelly in Multiple threads?

I have a set of huge taks to be performed in c#. Each calcuation will produce a resultant data which i want to write into a file (i am using SQLite). Currently i am doing this in a sequential way like ...
2
votes
1answer
81 views

Task.WaitAll method vs Parallel.Invoke method

I have sample code to compare processing time for Parallel approach and Task approach. The goal of this experiment is understanding of how do they work. So my questions are: Why Parallel worked ...
2
votes
0answers
334 views

Switching to UI context in a continuation, using TaskScheduler.FromCurrentSynchronizationContext()

I'm trying to catch the error which my method throws by using a continuation. I then want to update the ui of my web forms page which called the tasks. I'm using the ...
1
vote
3answers
1k views

Parallel Tasks being handled as sequential

I'm trying to wrap my head around the whole Parallel Programming concept, mostly focusing on Tasks, so I've been trying this scenario where, say, up to 9 Parallel Tasks would perform their work for a ...
1
vote
2answers
76 views

opencl - resources for multiple commandqueues

I'm working on an application where I real-time process a video feed on my GPU and once in a while I need to do some resource extensive calculations on my GPU besides that. My problem now is that I ...
1
vote
3answers
727 views

Streamwriter, StringBuilder and Parallel loops

Sorry for big chunk of code, I couldn't explain that with less.Basically I'm trying to write into a file from many tasks. Can you guys please tell me what I'm doing wrong? _streamWriter.WriteLine() ...
1
vote
1answer
2k views

task.Wait throwing an exception

Largely as a follow-up to this post I have come up with some code that works if I don't have the task wait, but fails if I do. Can anyone explain why? Cheers, Berryl ====== Exception I get this ...
1
vote
3answers
211 views

ThreadPoolExecutor - Specifying Which Thread Handles a Given Task

Is there a good way to implement an execution policy that determines which Thread will handle a given task based on some identification scheme? or is this even a good approach? I have a requirement ...

1 2 3
15 30 50 per page