Tornado 6.5 Documentationmake_app(): return tornado.web.Application([ (r"/", MainHandler), ]) async def main(): app = make_app() app.listen(8888) await asyncio.Event().wait() if __name__ == "__main__": asyncio.run(main()) components like the IOLoop that use callbacks. Futures are usually transformed into their result with the await or yield keywords. Examples Here is a sample synchronous function: from tornado.httpclient import coroutine: from tornado.httpclient import AsyncHTTPClient async def asynchronous_fetch(url): http_client = AsyncHTTPClient() response = await http_client.fetch(url) return response.body Or for compatibility0 码力 | 272 页 | 1.12 MB | 3 月前3
Tornado 6.5 Documentationreturn tornado.web.Application([ (r"/", MainHandler), ]) async def main(): app = make_app() app.listen(8888) await asyncio.Event().wait()if __name__ == "__main__": asyncio.run(main()) components like the IOLoop that use callbacks. Futures are usually transformed into their result with the await or yield keywords. Examples Here is a sample synchronous function: from tornado.httpclient import coroutine: from tornado.httpclient import AsyncHTTPClient async def asynchronous_fetch(url): http_client = AsyncHTTPClient() response = await http_client.fetch(url) return response.body Or for0 码力 | 437 页 | 405.14 KB | 3 月前3
Rust 程序设计语言 简体中文版 1.85.0373 17. Async 和 await . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 17.1. Futures 和 async 语法 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378 17.2. 并发与 async . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405 17.5. 深入理解 async 相关的 traits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0 码力 | 562 页 | 3.23 MB | 21 天前3
Open Flags 调研// up as an async_err here because it could have been the same // bytes we wrote via this Fh). int async_err = {0}; int take_async_err() { int e = async_err; async_err = 0;0 码力 | 23 页 | 524.47 KB | 6 月前3
julia 1.10.10other operations that use f(x): julia> g(x) = f(x) g (generic function with 1 method) julia> t = @async f(wait()); yield(); Now we add some new methods to f(x): julia> f(x::Int) = "definition for Int" julia> g(1) "definition for Int" julia> fetch(schedule(t, 1)) "original definition" julia> t = @async f(wait()); yield(); julia> fetch(schedule(t, 1)) "definition for Int"CHAPTER 12. METHODS 160 12 package called Sockets. Let's first create a simple server: julia> using Sockets julia> errormonitor(@async begin server = listen(2000) while true sock = accept(server) println("Hello World\n") end end)0 码力 | 1692 页 | 6.34 MB | 3 月前3
Julia 1.10.9other operations that use f(x): julia> g(x) = f(x) g (generic function with 1 method) julia> t = @async f(wait()); yield(); Now we add some new methods to f(x): julia> f(x::Int) = "definition for Int" julia> g(1) "definition for Int" julia> fetch(schedule(t, 1)) "original definition" julia> t = @async f(wait()); yield(); julia> fetch(schedule(t, 1)) "definition for Int"CHAPTER 12. METHODS 160 12 package called Sockets. Let's first create a simple server: julia> using Sockets julia> errormonitor(@async begin server = listen(2000) while true sock = accept(server) println("Hello World\n") end end)0 码力 | 1692 页 | 6.34 MB | 3 月前3
Julia 1.11.4other operations that use f(x): julia> g(x) = f(x) g (generic function with 1 method) julia> t = @async f(wait()); yield(); Now we add some new methods to f(x): julia> f(x::Int) = "definition for Int" julia> g(1) "definition for Int" julia> fetch(schedule(t, 1)) "original definition" julia> t = @async f(wait()); yield(); julia> fetch(schedule(t, 1)) "definition for Int" 13.6 Design Patterns with package called Sockets. Let's first create a simple server: julia> using Sockets julia> errormonitor(@async begin server = listen(2000) while true sock = accept(server) println("Hello World\n") end end)0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.5 Documentationother operations that use f(x): julia> g(x) = f(x) g (generic function with 1 method) julia> t = @async f(wait()); yield(); Now we add some new methods to f(x): julia> f(x::Int) = "definition for Int" julia> g(1) "definition for Int" julia> fetch(schedule(t, 1)) "original definition" julia> t = @async f(wait()); yield(); julia> fetch(schedule(t, 1)) "definition for Int" 13.6 Design Patterns with package called Sockets. Let's first create a simple server: julia> using Sockets julia> errormonitor(@async begin server = listen(2000) while true sock = accept(server) println("Hello World\n") end end)0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.6 Release Notesother operations that use f(x): julia> g(x) = f(x) g (generic function with 1 method) julia> t = @async f(wait()); yield(); Now we add some new methods to f(x): julia> f(x::Int) = "definition for Int" julia> g(1) "definition for Int" julia> fetch(schedule(t, 1)) "original definition" julia> t = @async f(wait()); yield(); julia> fetch(schedule(t, 1)) "definition for Int" 13.6 Design Patterns with package called Sockets. Let's first create a simple server: julia> using Sockets julia> errormonitor(@async begin server = listen(2000) while true sock = accept(server) println("Hello World\n") end end)0 码力 | 2007 页 | 6.73 MB | 3 月前3
julia 1.12.0 beta1other operations that use f(x): julia> g(x) = f(x) g (generic function with 1 method) julia> t = @async f(wait()); yield(); Now we add some new methods to f(x): julia> f(x::Int) = "definition for Int" julia> g(1) "definition for Int" julia> fetch(schedule(t, 1)) "original definition" julia> t = @async f(wait()); yield(); julia> fetch(schedule(t, 1)) "definition for Int" 13.6 Design Patterns with Base.AsyncCondition() wait(cond) The callback you pass to C should only execute a ccall to :uv_async_send, passing cond.handle as the argument, taking care to avoid any allocations or other interactions0 码力 | 2047 页 | 7.41 MB | 3 月前3
共 15 条
- 1
- 2













