cancellationtokensource Questions
7
The Abortcontroller signal is not working for me with Axios in React.
I wanted to replace CancelToken (as it's deprecated) with the AbortController, but it is not working, respectively the requests...
Brilliance asked 16/2, 2022 at 7:36
5
Solved
I start a task, that starts other tasks and so forth. Given that tree, if any task fails the result of the whole operation is useless. I'm considering using cancellation tokens. To my surprise, the...
Accessible asked 16/6, 2015 at 18:23
6
Solved
I am trying to delay the processing of a method (SubmitQuery() in the example) called from an keyboard event in WinRT until there has been no further events for a time period (500ms in this case).
...
Binion asked 11/12, 2013 at 1:59
5
Solved
I have a multi-threaded application and a CancellationToken is used as a shared object. Every thread can trigger it to tell the other threads the job is cancelled. Then one thread does the clean-up...
Lillis asked 13/4, 2011 at 20:40
4
Solved
How can I pause the executing until the cancellation is requested?
var cts = new CancellationTokenSource();
Task.Run(() =>
{
// Wait for the Cancel...
Console.WriteLine("Canceled!");
});
C...
Protomartyr asked 9/10, 2016 at 10:56
2
While writing a class to download images from a server in parallel (employing a consumer/producer pattern backed by the DataFlow TPL library), using an ActionBlock and Flurl.Http facility method Do...
Whoa asked 26/2, 2022 at 17:25
1
Solved
CancellationTokenSource has a TryReset() member. The documentation appears so strict as to make me wonder why it exists.
It will only work if no-one has already called Cancel() on it.
It is only v...
Clymer asked 9/2, 2022 at 0:12
1
Solved
I developed a C# based Windows Service which runs all of its logic in several different tasks.
To allow the service to shutdown gracefully when it is being stopped, I am using a CancellationToken w...
Underhung asked 6/10, 2021 at 14:57
3
Solved
I have been playing round with the Async CTP this morning and have a simple program with a button and a label. Click the button and it starts updating the label, stop the button it stops writing to...
Olinger asked 17/2, 2012 at 17:11
4
When the NamedPipeServer stream reads any data from the pipe it does not react to CancellationTokenSource.Cancel()
Why is that?
How can I limit the time I'm waiting in the server for data from th...
Joe asked 3/10, 2018 at 17:18
0
The Rx library includes operators that accept lambda parameters, and some of these lambdas are provided with a CancellationToken that is controlled by the library itself. Some examples of these ope...
Elevated asked 26/2, 2021 at 8:18
4
Solved
I use a cancellation token that is passed around so that my service can be shut down cleanly. The service has logic that keeps trying to connect to other services, so the token is a good way to bre...
Bevbevan asked 14/4, 2015 at 8:59
3
Solved
I have a situation where a call to CancellationTokenSource.Cancel never returns. Instead, after Cancel is called (and before it returns) the execution continues with the cancellation code of the co...
Gardas asked 18/7, 2015 at 20:44
1
Solved
I'm not sure if I'm stopping a Parallel.ForEach loop as I intend to do.
So let me outline the problem.
The loop uses a database driver with limited available connections and it is required to ke...
Kookaburra asked 9/6, 2020 at 10:7
7
Solved
The class CancellationTokenSource is disposable. A quick look in Reflector proves usage of KernelEvent, a (very likely) unmanaged resource.
Since CancellationTokenSource has no finalizer, if we do ...
Argilliferous asked 5/8, 2011 at 17:51
3
Solved
Consider a scenario where you have some asynchronous work to be done and you can run it in a fire and forget mode. This asynchronous work is able to listen for cancellation and so you pass it a can...
Clarsach asked 22/4, 2020 at 7:24
1
Solved
Hi I have a listbox Whenever a user selects an item a request is sent to the web Now I want to cancel the previous operation when the user selected the item and then start the new operation.
I use...
Circumnavigate asked 26/12, 2019 at 5:59
2
Solved
I have code that creates a CancellationTokenSource and that passes it to a method.
I have code in another are of the app that issues a cts.Cancel();
Is there a way that I can cause that method t...
Turnkey asked 9/12, 2019 at 5:49
2
Solved
I have a class that owns a CancellationTokenSource.
public class GrabboxCell : UICollectionViewCell
{
CancellationTokenSource _tokenSource = new CancellationTokenSource ();
// ...
}
I'm using...
Tetraspore asked 2/2, 2013 at 10:58
5
Solved
What's the best way to sleep a certain amount of time, but be able to be interrupted by a IsCancellationRequested from a CancellationToken?
I'm looking for a solution which works in .NET Framework ...
Chanty asked 10/9, 2013 at 9:21
3
Solved
Given the following code:
var cts = new CancellationTokenSource();
try
{
// get a "hot" task
var task = new HttpClient().GetAsync("http://www.google.com", cts.Token);
// request cancellation...
Laccolith asked 28/3, 2015 at 15:44
2
For example, if I want to cancel some operation in a Dispose() call (which can be called multiple times), then do I need to write
public void Dispose()
{
if (!cancellationTokenSource.IsCancellati...
Nasal asked 15/10, 2018 at 21:22
2
Solved
I'm trying to set a default timeout for my HttpClient calls to 5 seconds.
I've done this via CancellationTokenSource.
Here's the pertinent bit of code:
var cancellationToken = new CancellationTo...
Shipment asked 7/8, 2017 at 7:50
4
Solved
OK, my questions is really simple. Why this code does not throw TaskCancelledException?
static void Main()
{
var v = Task.Run(() =>
{
Thread.Sleep(1000);
return 10;
}, new Cancellati...
Riddance asked 25/3, 2014 at 14:32
2
Solved
I am trying to build an interface for a game. The game runs for 1 minute.
The GetStop method stops after 60 sec game. The play method starts the game and the quit method quit the game. Now ideally...
Quartis asked 2/7, 2018 at 7:13
1 Next >
© 2022 - 2024 — McMap. All rights reserved.