task Questions
2
Solved
The docs for cancel make it sound like you should usually propagate CancelledError exceptions:
Therefore, unlike Future.cancel(), Task.cancel() does not guarantee that the Task will be cancelled, ...
Crucible asked 10/2 at 19:54
3
Solved
For simplicity let's imagine we have a method that should return an object while doing some heavy operation. There're two ways to implement:
public Task<object> Foo()
{
return Task.Ru...
Upanishad asked 25/3, 2016 at 7:44
4
Solved
I have a PowerShell script like this:
Foreach ($file in $files) {
[Do something]
[Do something]
[Do something]
}
This way one file is treated after the other. I want to treat 4 files at the s...
Berliner asked 28/4, 2017 at 17:9
6
Solved
Let's say I have 100 tasks that do something that takes 10 seconds.
Now I want to only run 10 at a time like when 1 of those 10 finishes another task gets executed till all are finished.
Now I alw...
Trinetta asked 28/12, 2012 at 19:58
4
Solved
I created following code:
using System;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
class Program
{
static void Main()
{
Console.WriteLine("M Start");
MyMethodAsy...
Ph asked 18/2, 2016 at 14:11
5
I have a script that works great manually. However, when I schedule it in Task Scheduler, the script never ends and so the next time it tries to run, it fails because the prior instance is still ru...
Clash asked 10/5, 2016 at 14:55
4
Solved
I'm working on a trace module which has to monitor FreeRTOS tasks' heap in order to detect stack overflows. I am wondering whether it is possible to get a task stack size after its creation. Can I ...
Stinky asked 20/2, 2020 at 11:0
3
I am trying to write a little asynchronous WebServer. Let me briefly describe the scenario:
My ESP32 as well is a router. So if I connect with my mobile phone into the WiFi the ESP32 is spreading a...
Nunnery asked 19/2, 2021 at 13:16
2
I have used a lot of distribute task package, like celery, python-rq, they all depend on a external service such as redis, rabbit-mq and so on.
But, usually I don't need a queue service, in anothe...
Superimpose asked 18/1, 2016 at 9:3
4
Solved
I am looking to get the method/action name from a task in C#. Specifically I am implementing a custom task scheduler, and would like to generate statistics on the duration a task runs, which I will...
Olimpiaolin asked 23/8, 2012 at 5:38
10
Is there any scenario where writing method like this:
public async Task<SomeResult> DoSomethingAsync()
{
// Some synchronous code might or might not be here... //
return await DoAnotherThi...
Cuckoopint asked 30/9, 2013 at 15:30
4
Solved
I am using an external library that has async methods, but not CancellationToken overloads.
Now currently I am using an extension method from another StackOverflow question to add a CancellationTo...
Misbehavior asked 14/6, 2017 at 9:5
2
Solved
When does a Task actually start?
public void DoSomething() {
Task myTask = DoSomethingAsync();
Task.WaitAll(new[] { myTask }, 2000);
}
public async Task DoSomethingAsync() {
await SomethingEl...
Townsley asked 29/3, 2017 at 9:19
7
Solved
The MSDN documentation for Task.ContinueWith has only one code example where one task (dTask) runs in the background, followed by (using ContinueWith) a second task (dTask2). The essence of the sam...
Professoriate asked 21/12, 2013 at 17:18
2
I'm trying to wrap the SerialPort's read method in a task that can be awaited, that way I can get the benefits of using a CancellationToken and the timeout from the SerialPort object. My issue is t...
Hajj asked 8/12, 2017 at 21:24
1
Solved
By default in a console application, async Tasks will run on the ThreadPool, which means that multiple tasks can run in parallel on different threads (and will, if you have a multi core processor)....
Bova asked 30/8, 2023 at 4:29
3
Solved
I am currently learning how to use Tasks, async and await in Windows Store ("Metro") apps. I stumbled upon the property Task.CurrentId and try to understand how it works.
According to MSDN it retu...
Decision asked 18/1, 2013 at 12:42
5
Solved
Using NSubstitute, how do you mock an exception being thrown in a method returning a Task?
Let's say our method signature looks something like this:
Task<List<object>> GetAllAsync();
...
Tompkins asked 12/7, 2016 at 21:7
3
Solved
The documentation of asyncio.create_task() states the following warning:
Important: Save a reference to the result of this function, to avoid a task disappearing mid execution. (source)
My questi...
Tad asked 20/4, 2022 at 11:25
6
Solved
I've got an application with multiple Dispatchers (aka GUI threads, aka message pumps) to ensure that a slow, unresponsive portion of the GUI runs without affecting the rest of the application too ...
Impress asked 16/6, 2011 at 8:9
9
Solved
Is there a way to re-assign the value for the Ant property task? Or is there another task available for that purpose?
Thaliathalidomide asked 8/12, 2009 at 12:44
4
Solved
In general especially when it comes to libraries or console apps, in order to fire and forget an async method, is it better to just call the async method without awaiting it or use Task.Run?
Basica...
Olmstead asked 20/3, 2020 at 16:55
9
Solved
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 ...
5
Solved
I am following tutorials to understand SwiftUI, and specifically how to call an API when a view appears.
I saw this:
List(results, id: \.trackId) { item in
ListRow(item)
}
.task {
// perform API ...
2
Solved
I have read these articles:
ASP.NET Core Performance Best Practices
When should I use Task.Run in Asp.Net Core?
Is it allowed to use Task.Run in an ASP.NET Core controller?
In the first article in ...
Minimalist asked 2/2, 2022 at 21:19
1 Next >
© 2022 - 2024 — McMap. All rights reserved.