Top "Cancellation-token" questions

CancellationToken Cancel not breaking out of BlockingCollection

I have a cancellation token like so static CancellationTokenSource TokenSource= new CancellationTokenSource(); I have a blocking collection like so BlockingCollection&…

c# collections parallel-processing cancellation-token
c# lock and listen to CancellationToken

I want to use lock or a similar synchronization to protect a critical section. At the same time I want …

c# multithreading .net-4.0 task-parallel-library cancellation-token
Cancellation Token in await method

There are many reasons to put a token in the constructor of a task, mentioned here: Cancellation token in Task …

c# async-await async-ctp cancellation-token
CancellationToken with async Dapper methods?

I'm using Dapper 1.31 from Nuget. I have this very simple code snippet, string connString = ""; string query = ""; int val = 0; CancellationTokenSource tokenSource = …

c# .net async-await dapper cancellation-token
How to cancel a running task?

I want to cancel a running task (when the users presses the escape key). when i click on "escape" key …

c# task cancellation cancellationtokensource cancellation-token
Why is the task is not cancelled when I call CancellationTokenSource's Cancel method in async method?

I created a small wrapper around CancellationToken and CancellationTokenSource. The problem I have is that the CancelAsync method of CancellationHelper …

c# asynchronous task cancellationtokensource cancellation-token