cancellation

AsyncTask is not cancelling the long running operation in android

自古美人都是妖i 提交于 2019-12-07 07:17:51
问题 I have to download huge amount of data from server. It is taking minimum 10 seconds to download. Here is my code to download using asyntask class. And I want to cancel the downloading operation unconditionally if the user clicks on home button while downloading operation is going on. The problem is... I'am executing cancel() method but it is not cancelling the downloading operation. I'am seeing that operation is running in background in logcat view even i came out of application. I just want

Angular 2 form validators messing with the cancel button

血红的双手。 提交于 2019-12-07 05:28:35
问题 I have a data gathering component which includes 'cancel' button to cancel the whole process. The problem is, if some of the HTML input fields which are validated by Angular 2 validators have focus, and are not valid, and I press the cancel button, the component is not removed. Instead, validators will fire and the cancel button press will be ignored. I have to press it for the second time, after the validators complain, to make the component disappear.Cancel button itself simply triggers

why does pthread_exit throw something caught by ellipsis?

别说谁变了你拦得住时间么 提交于 2019-12-06 17:39:08
问题 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"<<std::endl; } why does the exception handler for ellipsis get called at the execution of pthread_exit ? (note that std::exception , for instance, are not thrown) 回答1: At least in GCC pthread_exit might throw an ___forced_unwind exception, that is used for unwinding the stack during the thread exit. It does not inherit

Cancel an 'HttpClient' POST request

 ̄綄美尐妖づ 提交于 2019-12-06 07:40:39
问题 I am uploading an image with HttpClient.PostAsync() on my Windows Phone 8 app. The user has the option to cancel this upload via a UI button. To cancel the POST request, I set a CancellationToken . But this doesn't work. After the cancellation request, I see still see the upload taking place in my proxy and it is evident that the request was ignored. My code: using (var content = new MultipartFormDataContent()) { var file = new StreamContent(stream); file .Headers.ContentDisposition = new

WF 4, WCF, cancel running workflow

我们两清 提交于 2019-12-06 06:32:17
Currently have a simple workflow exposed as a service endpoint. The service correlates on the workflow instance id and everything works as expected (2 service calls available ReceiveBegin, Execute). My problem is that I would like the user to be able to cancel the long running part of the workflow by calling another Receive on the workflow. Have had a look at the WorkflowApplication.Cancel but as I am running this as a WCF service it doesn't seem to be available. Documentation seems a bit light on this area and most HOL and examples focus on console apps hosting the workflow. With workflow

How to cancel an observable sequence

♀尐吖头ヾ 提交于 2019-12-06 03:02:25
问题 I have a very simple IObservable<int> that acts as a pulse generator every 500ms: var pulses = Observable.GenerateWithTime(0, i => true, i => i + 1, i => i, i => TimeSpan.FromMilliseconds(500)) And I have a CancellationTokenSource (that is used to cancel other work that is going on simultaneously). How can I use the cancellation token source to cancel my observable sequence? 回答1: If you're using the GenerateWithTime (replaced now with Generate passing in a timespan func overload), you can

Implementing cancellable syscalls in userspace

微笑、不失礼 提交于 2019-12-05 19:25:56
问题 I'm working on implementing pthread cancellation on Linux without any of the "unpleasant behavior" (some might say bugs) discussed in some of my other recent questions. The Linux/glibc approach to pthread cancellation so far has been to treat it as something that doesn't need kernel support, and that can be handled at the library level purely by enabling asynchronous cancellation before making a syscall, and restoring the previous cancellation state after the syscall returns. This has at

AsyncTask is not cancelling the long running operation in android

寵の児 提交于 2019-12-05 14:47:58
I have to download huge amount of data from server. It is taking minimum 10 seconds to download. Here is my code to download using asyntask class. And I want to cancel the downloading operation unconditionally if the user clicks on home button while downloading operation is going on. The problem is... I'am executing cancel() method but it is not cancelling the downloading operation. I'am seeing that operation is running in background in logcat view even i came out of application. I just want to stop the execution of doInBackground() method. Please guide/help me. on click of download button :

How can I stop async Process by CancellationToken?

两盒软妹~` 提交于 2019-12-05 14:29:51
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.. https://msdn.microsoft.com/en-us/library/jj155759.aspx . But, It was hard that applying this CancellationToken at this code.. Anyone can help this problem? I use public static async Task<int> RunProcessAsync(string fileName, string args) method only. Code (From https://stackoverflow.com/a/31492250 ): public static async Task<int> RunProcessAsync(string fileName, string args) {

Angular 2 form validators messing with the cancel button

让人想犯罪 __ 提交于 2019-12-05 12:22:23
I have a data gathering component which includes 'cancel' button to cancel the whole process. The problem is, if some of the HTML input fields which are validated by Angular 2 validators have focus, and are not valid, and I press the cancel button, the component is not removed. Instead, validators will fire and the cancel button press will be ignored. I have to press it for the second time, after the validators complain, to make the component disappear.Cancel button itself simply triggers routing away from the component. Relevant code: component.html <form [formGroup]="addReminderForm"