KO
|
EN
gitlite — search
Search
#javascript
#python
#ruby
#php
#wordpress
#hacktoberfest
#dotfiles
#shell
#erlang
#vim
#library
#c
fiber-await
★ 53
Open GitHub ↗
Win32 Fiber async/await demo
Download README (.md)
Explore Similar Repositories
feishu-docs-workflow
:
Alfred workflow for feishu docs.
heic-to-jpg
:
HEIC to JPG file format batch conversion script
latex-scnu
:
华师毕业论文模板, 华师本科毕业论文模板, 华师论文模板, latex 模板, 毕业论文模板, SCNU, SCNU 论文模板, SCNU 本科论文模板
altair
:
Lightweight and Robust API Gateway written in Go
bzijkPlayer
:
基于cmake构建的ijkPlayer
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
fiber-await
?
Download (.md)
# Win32 Fiber Async/await Demo This is an example of using fibers to await on any kernel object handle. Due to limitations of the Win32 API, only 64 coroutines can run at once. Main article: [Fibers: the Most Elegant Windows API](https://nullprogram.com/blog/2019/03/28/) ## API ```c /** * Initialize the async/await system. * Must be called before any other async/await functions. */ void async_initialize(void); /** * Tear down the async-await system. * This should not be run until all coroutines have terminated. */ void async_shutdown(void); /** * Runs the main scheduler loop until all coroutines have terminated. * This function can be called more than once, though it only makes * sense if at least one coroutine has been started with async_start(). */ void async_run(void); /** * Create and start a new coroutine. * The coroutine is immediately started. Returns the first time the new * coroutine blocks or exits. Returns 1 on success, or 0 if too many * coroutines are running. Only 64 coroutines can run at once. */ int async_start(void (*)(void *), void *); /** * Await on a kernel object. * Destroys the handle via CloseHandle() when done. */ void async_await(HANDLE); /** * Terminate the current coroutine. */ void async_exit(void); /** * Return a handle that signals after the given time. * The returned a handle suitable for async_await() and is useful for * pausing the current coroutine for a time period. */ HANDLE async_sleep(double seconds); ```