Questions tagged [cancellation]

Cancellation is paradigm that allows cooperatively canceling a running operation before it finishes.

Cancellation is paradigm that allows cooperatively canceling a running operation before it finishes.

In , cancellation is achieved using for signaling cancellation and a CancellationToken is used by the operation to check whether cancellation was requested.

712 questions
15
votes
3 answers

how can I cancel an Ajax request?

In phonegap how to cancel an ajax request in program, I would like to set cancel button for control the request when it's too slow $.ajax({ type: "GET", url: url, success: function(m) { alert( "success"); } });
oops
  • 205
  • 2
  • 11
15
votes
2 answers

Checking if a Java Timer is cancelled

Why is there no isCancelled method for a java.util.Timer object? I would like to schedule a task if the Timer has not been cancelled, and run it directly (on the same thread) if it has been cancelled. Is the only option to catch the…
Simon Forsberg
  • 13,086
  • 10
  • 64
  • 108
15
votes
1 answer

why does pthread_exit throw something caught by ellipsis?

if the function called by pthread_create has the following structure try{ ...code.... pthread_detach(pthread_self()); pthread_exit(NULL); }catch(...){ std::cout<<"I am here"<
Fabio Dalla Libera
  • 1,297
  • 1
  • 10
  • 24
14
votes
6 answers

How to integrate AbortController with Axios and React?

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 are not being canceled. let testController:…
14
votes
2 answers

Stop Parallel.ForEachAsync

In C#, I am interested in stopping a Parallel.ForEachAsync loop (considering the differences between Stop and Break); for Parallel.ForEach I can do the following: Parallel.ForEach(items, (item, state) => { if…
14
votes
1 answer

Getting the saved instruction pointer address from a signal handler

My question is somewhat different from others that have asked about fault addresses. I'm trying to implement a horrible hack to determine, from a signal handler, whether the signal interrupted a syscall or ordinary user code by inspecting the code…
R.. GitHub STOP HELPING ICE
  • 208,859
  • 35
  • 376
  • 711
13
votes
3 answers

Stopping a task without a CancellationToken

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 CancellationToken: public async static Task…
Tim
  • 2,968
  • 5
  • 29
  • 55
13
votes
1 answer

F# How Async<'T> cancellation works?

I was pretty comfortable with how async cancellations where done in C# with the TPL, but I am a little bit confused in F#. Apparently by calling Async.CancelDefaultToken() is enough to cancel outgoing Async<'T> operations. But they are not cancelled…
vtortola
  • 34,709
  • 29
  • 161
  • 263
13
votes
2 answers

Active Noise Cancellation through default iPhone headphone

We want to create an App that will implement the Active Noise Cancellation using the default iPhone headphone. That is, to receive the external audio using the iPhone headphone Mic and make a phase shift of 180 degree. Finally, to play the inverted…
Ashok
  • 192
  • 1
  • 1
  • 9
12
votes
2 answers

How can I stop async Process by CancellationToken?

I found beneath code for execute some process without freezing UI. This code is executed when 'Start Work' button is pressed. And I think users would stop this work by 'Stop' button. So I found this article at MSDN..…
youngminz
  • 1,364
  • 2
  • 14
  • 23
11
votes
1 answer

Proper way to use LINQ with CancellationToken

I am trying to write a LINQ query that would support cancellation using the CancellationToken mechanism that is provided in the .NET framework. However, it's unclear what the proper way to combine cancellation and LINQ would be. With PLINQ, it's…
LBushkin
  • 129,300
  • 32
  • 216
  • 265
11
votes
2 answers

std::atomic_bool for cancellation flag: is std::memory_order_relaxed the correct memory order?

I have a thread that reads from a socket and generates data. After every operation, the thread checks a std::atomic_bool flag to see if it must exit early. In order to cancel the operation, I set the cancellation flag to true, then call join() on…
Paul Belanger
  • 2,354
  • 14
  • 23
11
votes
2 answers

How to stop a java code from running using a stop button

I have a button that calls a method from the backing Bean. This method allows to extract data from parsing html code. While the method is running i have a dialog showing a progress bar and a command button Cancel. I need when the user click the…
junior developper
  • 448
  • 2
  • 19
  • 40
11
votes
4 answers

Cancellation with Future and Promise in Scala

This is a followup to my previous question. Suppose I have a task, which executes an interruptible blocking call. I would like to run it as a Future and cancel it with failure method of Promise. I would like the cancel to work as follows: If one…
Michael
  • 41,026
  • 70
  • 193
  • 341
10
votes
1 answer

Is there any movement towards specifying interaction of C++ exceptions and pthread cancellation?

The GNU C library uses DWARF2 unwinding for pthread cancellation these days, so that both C++ exceptions and pthread cancellation cleanup handlers get called through a common call frame unwinding process which invokes destructors for automatic…
R.. GitHub STOP HELPING ICE
  • 208,859
  • 35
  • 376
  • 711
1 2
3
47 48