cancellation

iOS MDM App Installation/Cancellation Response

眉间皱痕 提交于 2019-12-11 18:46:32
问题 I have developed an MDM Server using the iOS APNS method and I am pushing apps to mobile devices. I want the MDM Server to know when the App was successfully installed or when the user cancels the alert for App Installation. I issue the InstallApplication command and I get an Acknowledgement with State as Queued but I want an acknowledgement when the State is Installed. I tried to issue an ManagedApplicationList command after the InstallApplication command so that I can check if the app

Is there a way to cancel execution of method in cancelled task?

旧城冷巷雨未停 提交于 2019-12-11 18:32:45
问题 I have a problem, that I could not find any answear yet. And this is my first project with use of threading and Tasks. When my task is cancelled, it keeps executing time consuming method. Right now I have not idea how to stop execution of the method together with the task. Below is a loop, that runs tasks. Every single task is running a ParseHorseData method, that runs also several other methods. Execution of them takes sometimes a lot of time. After the task is cancelled, before await Task

Async.Start with timeout and cancellationToken?

断了今生、忘了曾经 提交于 2019-12-11 08:07:45
问题 I have an Async<'T> computation that I want to run, and obtain the result 'T . I only have two requirements: After certain timeout:TimeSpan has passed, I want the computation/IO to be aborted. I want to run it with a cancellationToken just in case I want to abort it before timeout has passed. According to my requirement (1) above, you might think that Async.StartChild is a good candidate because it accepts a timeout parameter, however, it doesn't accept a cancellationToken parameter! It seems

Using a CancellationToken to cancel a task without explicitly checking within the task?

六眼飞鱼酱① 提交于 2019-12-11 05:07:36
问题 Background: I have a web application which kicks off long running (and stateless) tasks: var task = Task.Run(() => await DoWork(foo)) task.Wait(); Because they are long running, I need to be able to cancel them from a separate web request. For this, I would like to use a CancellationToken and just throw an exception as soon as the token is canceled. However, from what I've read, Task Cancellation is cooperative, meaning the code the task is running must explicitly check the token to see if a

Thread lifecycle on ThreadDeath

蹲街弑〆低调 提交于 2019-12-11 02:37:43
问题 I wanted to start a computation and terminate it on user Cancel. You say that calling Thead.stop() unlocks all monitors and raises ThreadDeath exception. This means that finally is still called. Suppose I do not care about the locks but want to release the resources allocated so far. I would like the canceller to know/wait until thread has finished released its allocations. Suppose the finally section has an infinite loop in the finally section. Will thread.join succeed to that thread? 回答1:

CancellationTokenSource.Cancel(false)

混江龙づ霸主 提交于 2019-12-11 01:44:15
问题 static void Main(string[] args) { CancellationTokenSource cts = new CancellationTokenSource(); ThreadPool.QueueUserWorkItem(o => DoWork(cts.Token, 100)); Thread.Sleep(500); try { cts.Token.Register(CancelCallback3); cts.Token.Register(CancelCallback2); cts.Token.Register(CancelCallback1); cts.Cancel(false); } catch (AggregateException ex) { foreach (Exception curEx in ex.Data) { Trace.WriteLine(curEx.ToString()); } } Console.ReadKey(); } private static void CancelCallback1() { Trace.WriteLine

Stoping jquery .then chain via user input

走远了吗. 提交于 2019-12-10 22:50:06
问题 This is probably a simple question, but i'm totally lost. I have this function. m.util.genericSwipeVertFunc = function ( ajaxRequest, swipeOutTarget, swipeInTarget ) { var stage1, stage2, failStage, dfd = $.Deferred(), finalStage, functionPromise; // Swipe of screen wait for ajax request stage1 = function () { return $.when( ajaxRequest, // Returns $.Deferred() m.util.animateDeffered(swipeOutTarget, "fadeOutDown", true) // Returns $.Deferred() ); }; // Swipe and Show stage2 = function () {

Proper way of cancel execution of a method [duplicate]

我的未来我决定 提交于 2019-12-10 13:09:47
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How do I abort/cancel TPL Tasks? I have a method that takes some time to execute therefore I return the result as a callback. My method looks like: public static void DoWork( Action<object> onCompleteCallBack) { Task.Factory.StartNew( () => { // Do work onCompleteCallBack(someResult); }); } Now I will like to be able to stop executing that method in case the user does not want to wait. As a result this is what I

How can I stop async Process by CancellationToken?

。_饼干妹妹 提交于 2019-12-10 09:19:38
问题 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:/

Abort ajax request in a promise

纵然是瞬间 提交于 2019-12-10 04:16:52
问题 I'm building a form validation and to learn promises I decided to implement asynchronous validation functions using promise pattern: var validateAjax = function(value) { return new Promise(function(resolve, reject) { $.ajax('data.json', {data: {value: value}}).success(function(data, status, xhr) { if (data.valid) { resolve(xhr) } else { reject(data.message) } }).error(function(xhr, textStatus) { reject(textStatus) }) }) } //... var validators = [validateAjax]; $('body').delegate('.validate',