Questions tagged [task]

A task is an abstraction that is used to work with concurrency, it can denote operation that should be executed concurrently with the rest of a program. A task is a concurrent thread of execution in Ada and represents an asynchronous operation in .NET, also it corresponds to Threads in Java.

A task is an abstraction that is used to work with concurrency, it can denote operation that should be executed concurrently with the rest of a program.

  • Ada
    A task is a concurrent thread of execution in an Ada program. Task definitions are split into two parts - declaration and a body, which is mandatory. Task declaration defines entities exported from the task, whereas its body contains local declarations and statements of the task.

  • .NET
    Task is used to represents an asynchronous operation, it is a core concept of the which is used for asynchronous and parallel programming in the .NET framework.

  • C++
    future is used to represent an operation which may complete some time in the future. It helps programs achieve a degree of asynchrony where they may want/need to perform certain operations in parallel. std::async creates a task which may execute asynchronously, returning a std::future.

See also:

Related tags

8481 questions
3
votes
2 answers

List of Tasks C#

var tasks = new List(); for (int i = 0; i < pageCount; i++) { var task = Task.Run(() => { worker.GetHouses(currentPage); }); tasks.Add(task); currentPage++; } Task.WaitAll(tasks.ToArray()); There is something i…
Lars
  • 736
  • 1
  • 8
  • 18
3
votes
2 answers

About pxHigherPriorityTaskWoken

In the description of xSemaphoreGiveFromISR at http://www.freertos.org/a00124.html is written: "From FreeRTOS V7.3.0 pxHigherPriorityTaskWoken is an optional parameter and can be set to NULL." The question is: If the parameter is NULL and there is…
i486
  • 6,491
  • 4
  • 24
  • 41
3
votes
1 answer

How do you run manual tasks within a Meteor project?

For example, in a Ruby project you can use rake to create and run tasks for performing manual operations. What is the equivalent, if any, when using Meteor? Let's say I have a function inside a server/tasks.js file: Meteor.startup(function() { …
Chip Castle
  • 2,132
  • 3
  • 20
  • 34
3
votes
1 answer

IActionFilter returning a new Task never returns

In an ASP.NET Web API project, I have an action filter which checks for model state errors and returns the Bad Request status code if there are any. It looks like this: public class ValidationFilter : IActionFilter { public…
Tomas Aschan
  • 58,548
  • 56
  • 243
  • 402
3
votes
2 answers

When should Task.Run() be used?

What's the difference between these two approaches: public static int Main(string[] args) { string result; Task.Run(async () => { Task getStringTask = GetStringAsync(); result = await validationsTask; …
Derek Patton
  • 223
  • 2
  • 8
3
votes
2 answers

How to guarantee that a Task runs synchronously on the current thread?

I'm aware that there are several similar questions on this and other websites, but the standard way of doing this doesn't appear to work in my situation for some reason. The normal way to accomplish this requirement is to use…
Sheridan
  • 68,826
  • 24
  • 143
  • 183
3
votes
1 answer

Using Task for non-live task

I have an Operation class like... public sealed class Operation { public void DoSomething1(ArgType1 arg) {...} public void DoSomething2(ArgType2 arg) {...} ... public Task Execute() {...} } The DoSomething methods package work to be…
John Jones
  • 41
  • 3
3
votes
3 answers

How to do C# asynchronous programming?

I'm working on an Export-Tool from a Database which I had written in Visual Basic.net before a long time. I switched to C# and like to reprogram it in C# since I've gathered quite a little bit more experience than I had before :-) My C#…
Sum1Unknown
  • 1,032
  • 1
  • 9
  • 14
3
votes
1 answer

Pausing a task within Task.Factory.StartNew

In my Asp.Net MVC 5 project I have a ~3 minute task that I pass to Task.Factory.StartNew(). I would like to pause the task from within the task if there is a validation issue in one of the steps of my code running in the task. I don't want to delay…
3
votes
0 answers

WPF Task/Threading Error Trapping and TaskContinuation options not working as expected

I have a couple of chained tasks that are kicked off using Task.Factory.StartNew(... After some serious pain they are running great. Now I'm going back to try to add better error checking for Tasks since that was much of the pain in getting the…
pStan
  • 1,084
  • 3
  • 14
  • 36
3
votes
1 answer

Unexpected output in Tasking?

Why it is not sure for below code that task_1 should execute first then task_2 because task_1 which is in waiting state get first start message from main? but output is not predictable please help me to understand? WITH Ada.Text_IO; …
pravu pp
  • 792
  • 7
  • 13
3
votes
1 answer

Concurrent background Task or Service with input and output arguments in JavaFX

It would rather be a very simple concept, but since I am totally new to concurrency in JavaFX. I have been struggling to understand this concept. While building a very simple JavaFX application, I wanted to perform some lengthy task in background…
Indigo
  • 2,887
  • 11
  • 52
  • 83
3
votes
1 answer

Wait for IProgress Report Method to Return

I am updating my UI via IProgress and the Report method. I do something like IProgress p = new Progress(ReportProgress); Task task = Task.Factory.StartNew(() => { result = Execute(p); }); where in the Execute method…
MoonKnight
  • 23,214
  • 40
  • 145
  • 277
3
votes
1 answer

Deadlock while blocking async HttpClient call within a task continuation

I am trying to wrap my head around synchronously calling async functions and deadlock. In the below example I am blocking an async call which internally uses ConfigureAwait(false) which as far as I can tell should prevent deadlock. The first call…
Alex K
  • 33
  • 5
3
votes
2 answers

NetworkStream truncates my data?

On the same computer I have 2 console applications. (client sends a file to server) Before I start I just want to mention that i'm using those 2 async functions : For reading from NetworkStream: public static Task ReadAsync1(this…
Royi Namir
  • 144,742
  • 138
  • 468
  • 792