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
56
votes
3 answers

Waiting for async/await inside a task

I have this construct in my main(), which creates var tasks = new List(); var t = Task.Factory.StartNew( async () => { Foo.Fim(); await Foo.DoBar(); }); //DoBar not completed t.Wait(); //Foo.Fim() done, Foo.DoBar…
Nathan Cooper
  • 6,262
  • 4
  • 36
  • 75
55
votes
4 answers

Gradle task check if property is defined

I have a Gradle task that executes a TestNG test suite. I want to be able to pass a flag to the task in order to use a special TestNG XML suite file (or just use the default suite if the flag isn't set). gradle test ... should run the default…
user2506293
  • 805
  • 1
  • 7
  • 13
54
votes
2 answers

Can .NET Task instances go out of scope during run?

If I have the following block of code in a method (using .NET 4 and the Task Parallel Library): var task = new Task(() => DoSomethingLongRunning()); task.Start(); and the method returns, will that task go out of scope and be garbage collected, or…
Hank
  • 8,289
  • 12
  • 47
  • 57
53
votes
4 answers

Python - What is queue.task_done() used for?

I wrote a script that has multiple threads (created with threading.Thread) fetching URLs from a Queue using queue.get_nowait(), and then processing the HTML. I am new to multi-threaded programming, and am having trouble understanding the purpose of…
J. Taylor
  • 4,567
  • 3
  • 35
  • 55
53
votes
4 answers

What's the difference between mustRunAfter and dependsOn in Gradle?

Whether taskB mustRunAfter taskA, or taskB dependsOn taskA, it seems that taskA runs first, then taskB runs. What's the difference?
Dan B.
  • 1,451
  • 2
  • 14
  • 23
52
votes
9 answers

Find out whether celery task exists

Is it possible to find out whether a task with a certain task id exists? When I try to get the status, I will always get pending. >>> AsyncResult('...').status 'PENDING' I want to know whether a given task id is a real celery task id and not a…
dominik
  • 5,745
  • 6
  • 34
  • 45
52
votes
3 answers

Activity stack ordering problem when launching application from Android app installer and from Home screen

For testing purposes only, I am allowing my app APK to be downloaded and installed via a URL. Once downloaded on the phone, it can be launched with the Android app installer which gives the user an option to install it to their device and then run…
antonyt
  • 21,863
  • 9
  • 71
  • 70
51
votes
5 answers

Set ApartmentState on a Task

I am trying to set the apartment state on a task but see no option in doing this. Is there a way to do this using a Task? for (int i = 0; i < zom.Count; i++) { Task t = Task.Factory.StartNew(zom[i].Process); t.Wait(); }
Luke101
  • 63,072
  • 85
  • 231
  • 359
50
votes
4 answers

App always starts fresh from root activity instead of resuming background state (Known Bug)

I am facing exactly the problem mentioned in these…
Monstieur
  • 7,992
  • 10
  • 51
  • 77
50
votes
2 answers

What happens while waiting on a Task's Result?

I'm using the HttpClient to post data to a remote service in a .NET 4.0 project. I'm not concerned with this operation blocking, so I figured I could skip ContinueWith or async/await and use Result. While debugging, I ran into an issue where the…
scottt732
  • 3,877
  • 2
  • 21
  • 23
49
votes
5 answers

How can I run both of these methods 'at the same time' in .NET 4.5?

I have a method which does 2 independent pieces of logic. I was hoping I can run them both at the same time .. and only continue afterwards when both those child methods have completed. I was trying to get my head around the async/await syntax but I…
Pure.Krome
  • 84,693
  • 113
  • 396
  • 647
48
votes
4 answers

Celery: How to ignore task result in chord or chain?

I'm using celery, I have several tasks which needed to be executed in order. For example I have this task: @celery.task def tprint(word): print word And I want to do something like this: >>> chain(tprint.s('a') | tprint.s('b'))() Then I get…
lxyu
  • 2,661
  • 5
  • 23
  • 29
47
votes
4 answers

IRequestHandler return void

Please see the code below: public class CreatePersonHandler : IRequestHandler { public async Task Handle(CreatePersonCommand message, CancellationToken cancellationToken) { return true; } } It…
w0051977
  • 15,099
  • 32
  • 152
  • 329
47
votes
5 answers

Return list from async/await method

I want to make a webservice request asynchron. I call it here: List list = GetListAsync(); Here is the declaration of my function, which should return a list: private async Task> GetListAsync(){ List list = await…
testing
  • 19,681
  • 50
  • 236
  • 417
43
votes
6 answers

Delete a Jenkins Build via GUI

How can I delete a build from the Jenkins GUI? I know that I can delete the directory from the 'jobs' folder, but I want to do it from the GUI. Is it also possible to delete multiple builds?
r.rodriguez
  • 907
  • 2
  • 9
  • 12