//**************************************** internal static AsyncHandleWaiter GetOrCreate(AsyncHandle handle) { if (!Instances.TryTake(out var Instance)) { Instance = new AsyncHandleWaiter(); } Instance.Initialise(handle); return(Instance); }
public UvLoopThread(LibUv libUv, string name, Action <OwinSocket> owinHttpProcess) { if (libUv == null) { throw new ArgumentNullException("libuv"); } _libuv = libUv; _name = name; _owinHttpProcess = owinHttpProcess; _loopHandle = new LoopHandle(); _asyncHand1 = new AsyncHandle(); _asyncHand2 = new AsyncHandle(); _loopThread = new Thread(InitLoopThread); }
public Listener(LibUv libUv, string bindAddr, int bindPort, string tmpPath, Action <OwinSocket> owinHttpProcess) { if (libUv == null) { throw new ArgumentNullException("libuv"); } _libuv = libUv; _bindAddr = bindAddr; //绑定的ip _bindPort = bindPort; //绑定的端口 _tmpPath = tmpPath; _owinHttpProcess = owinHttpProcess; _loopHandle = new LoopHandle(); _asyncHand1 = new AsyncHandle(); _asyncHand2 = new AsyncHandle(); _loopThread = new Thread(InitLoopThread); }
private static async Task ReloadApplicationTask(IAppIdentifier appIdentifier) { using (IApp app = await _qlikSenseServer.AppAsync(appIdentifier, noVersionCheck: true)) { Console.WriteLine("App with name {0} opened", appIdentifier.AppName); AsyncHandle reloadHandle = new AsyncHandle("reloadTask"); // By setting mode parameter on reload you can affect the behaviour check the help for more information. // http://help.qlik.com/sense/2.1/en-US/apis/net%20sdk/html/M_Qlik_Engine_App_DoReload.htm // During the reload task you can cancel the reload by calling app.Session.Hub.CancelReload() you should also need to cancel the "reloadTask" try { var reloadTask = app.DoReloadAsync(reloadHandle, OnReloaded); bool doWork = true; while (doWork) { var progress = await app.Session.Hub.GetProgressAsync(reloadHandle); Console.WriteLine("Progress: " + progress.TransientProgress + " Finished : " + progress.Finished); if (progress.Finished) { doWork = false; } System.Threading.Thread.Sleep(1000); // Give the qlik engine time to work before we check the progress again. } await app.DoSaveAsync(); Console.WriteLine("App with name {0} saved and last reloaded {1}", appIdentifier.AppName, (await app.GetAppLayoutAsync()).LastReloadTime); } catch (TimeoutException e) { // We got a timeout exception from the SDK, handle this should be handled. In this example will just cancel the reload in the engine and igonre it. app.Session.Hub.CancelReload(); } } }
public void Iterate(int inFrom, int inTo, AsyncFlags inFlags) { handle.Cancel(); handle = Async.For(inFrom, inTo, LogTimestamp, inFlags); first = true; }
//**************************************** internal void Initialise(AsyncHandle handle) { Handle = handle; }