An error occurred in script '/home/yhr1ef23xez5/public_html/web2/app/model/bannerhit.php' on line 17:
Undefined index: HTTP_REFERER
Array ( [type] => post [name] => await )
WinWrap® Basic scripts can await Async methods.
The Await function waits for the Async method to complete and returns the result. Script events can be handled and the UI is not blocked while Await is waiting for the Async method to complete.
The following sample script uses an HttpClient.GetAsync and HttpResponse.Content.ReadAsStringAsync to read a web page.
Await handles all the issues when dealing with Async methods. Unlike VB.NET, a WinWrap® Basic method containing Awaits does not need to be an Async method.
When an Async method executes in a worker thread the callback defined by the script executes in the script's thread.
WinWrap Basic Thread | Worker Thread | |||
Script | Mediator | Mediator | Async | |
Sub A ... Dim B As T1 = Await CAsync(AddressOf D, ScriptCancellationToken) |
||||
... DoEvents events | ||||
T1 CAsync(Func<...> callback, CancellationToken
token) { ... T2 E = callback.Invoke(args); |
||||
evh = new EventWaitHandle(...); push pending call "D(args)" evh.WaitOne() |
||||
pop pending call "D(args)" | worker thread stopped | |||
Function D(args) As T2 ... Return Dresult End Function |
||||
Dtemp = Dresult evh.Set() |
||||
... DoEvents events | // evh.WaitOne() completes | |||
E = Dtemp; ... return Cresult; } |
||||
B = Cresult ... End Sub A |
Copyright Polar Engineering, Inc.