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
1 answer

Job Shop Scheduling: Shifting Bottleneck

I'm currently looking into quick graph because I need to implement Job Shop Scheduling. I have been researching and found the shifting bottleneck algorithm very promising. As I'm not really proficient in math and search algorithm I wanted to ask you…
Daniel Marbach
  • 2,294
  • 12
  • 15
3
votes
1 answer

What's the difference between these three Task Continuations?

I have these two scenarios, but I don't understand why things are happening as they do: static void Main(string[] args) { Console.WriteLine("***Starting T1"); //run two tasks sequentially Task t =…
Simon
  • 9,197
  • 13
  • 72
  • 115
3
votes
2 answers

Immediately a Task for a call that's constructed inside a ContinueWith block?

First off, apologies for the title; I couldn't really think of how to succinctly articulate what I'm trying to do. I have the following two functions: Main code: private async Task PrepareRoundtrip() { PreparationInfo output =…
Benjin
  • 2,264
  • 2
  • 25
  • 50
3
votes
0 answers

FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS is not working in KitKat and above

My Activity A is opening Activity B in another task. I'm trying to have only one task icon in task bar/recent apps. Activity B is started with the following flags: Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_NEW_TASK In OS…
Nitz1
  • 31
  • 4
3
votes
3 answers

Limited concurrency TaskScheduler that can interleave tasks to be explicitly ordered

I am looking for a TaskScheduler that: Allows me to define a number of dedicated threads (e.g. 8) - a standard LimitedConcurrencyLevelTaskScheduler (uses threadpool threads) or WorkStealingTaskScheduler do this. Allows me to create…
3
votes
0 answers

Persistant version of the task-parallel library?

The .NET Task Parallel Library has great facilities for managing asynchronous work. You can check for status, capture exceptions, schedule continuations, etc. However, this all occurs in memory. Is there any way in .NET to use the TPL (or something…
ChaseMedallion
  • 20,860
  • 17
  • 88
  • 152
3
votes
6 answers

How to make Gradle run tasks in certain order?

Let's say that I have created separate tasks for running integration and acceptance tests in my gradle build script. When I run the build task I want to run testing tasks before in this order: unit tests(test task), integration tests…
Rade Milovic
  • 965
  • 4
  • 13
  • 29
3
votes
3 answers

Initialize Async Only Once Pattern

Let's say that I have a class with members which require asynchronous actions to initialize (such as file i/o or web requests). I only need to initialize once, and I don't want to reinitialize. Are Tasks and Async-Await a good fit to accomplish…
3
votes
1 answer

How to wait for tasks of varying types?

I am trying to asynchronously complete four tasks and when they are all complete, append them to an object and return it. Here is my code: Task[] tasks = new Task[4]; tasks[0] = wtData.GetHFServiceData(wtTransfreeeId); tasks[1] =…
user1477388
  • 20,790
  • 32
  • 144
  • 264
3
votes
4 answers

Use a Task to avoid multiple calls to expensive operation and to cache its result

I have an async method that fetches some data from a database. This operation is fairly expensive, and takes a long time to complete. As a result, I'd like to cache the method's return value. However, it's possible that the async method will be…
Nathan Friend
  • 12,155
  • 10
  • 75
  • 125
3
votes
2 answers

How to - Multiple Async tasks with timeout and cancellation

I would like to fire several tasks while setting a timeout on them. The idea is to gather the results from the tasks that beat the clock, and cancel (or even just ignore) the other tasks. I tried using extension methods WithCancellation as explained…
Erez Cohen
  • 1,507
  • 2
  • 16
  • 25
3
votes
3 answers

Problems with show dialog on Background task in windows phone 8.1

I have this code for execute httpwebrequest and response in background method and i just want show dialog for information when download zip crashed and my code enter in this catch... private void DoSincroFit() { HttpWebRequest…
3
votes
1 answer

Failing tasks in Rust

I'm looking for some clarification on task failure. As I understand it, if task 1 spawns task 2, task 2 is a child of task 1. If task 1 fails, does it automatically fail and clean up after task 2? For example, I start a i/o task on a socket like…
nathansizemore
  • 3,028
  • 7
  • 39
  • 63
3
votes
1 answer

Task.ContinueWith() is not executing as expected

Im trying to rewrite some of my old code using async/await and chaining Tasks using ContinueWith() and checking for exceptions with TaskContinuationOptions.NotOnFaulted. When I debug the code I noticed that it does not run as I expected. Both…
Timo1995
  • 137
  • 1
  • 3
  • 9
3
votes
1 answer

Why does a Thread.Sleep running in a Task not block the WinForms UI Thread?

I'm currently playing around with Tasks in C# and Window Forms and I've ran into a strange effect. I have a Form which contains a timer that ticks every 300 ms. The tick event changes the background of a control in that form to a random color. I…
user20584
  • 41
  • 4