From c0365995766ef816c177b4db81e837726047a7d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Magnenat?= Date: Mon, 3 May 2021 09:44:39 +0200 Subject: [PATCH 1/2] Added simple-async-local-executor to newsletter 21. --- content/news/021/index.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/content/news/021/index.md b/content/news/021/index.md index 3312798ad..16b2f49e3 100644 --- a/content/news/021/index.md +++ b/content/news/021/index.md @@ -306,6 +306,36 @@ Profiling is used by multiple projects including `gfx-hal`, `rafx`, and [profiling]: https://crates.io/crates/profiling +### [simple-async-local-executor] + +```rust +let executor = Executor::default(); +let events = [executor.create_event_handle(), executor.create_event_handle()]; + +async fn wait_event(events: [EventHandle; 2], executor: Executor) { + executor.event(&events[0]).await; + executor.event(&events[1]).await; +} + +executor.spawn(wait_event(events.clone(), executor.clone())); +assert_eq!(executor.step(), true); +assert_eq!(executor.step(), true); +executor.notify_event(&events[0]); +assert_eq!(executor.step(), true); +executor.notify_event(&events[1]); +assert_eq!(executor.step(), false); +``` + +[simple-async-local-executor] by [Enlightware] +is a single-threaded polling-based executor suitable for use in games, embedded systems or WASM. + +This executor can be useful when the number of tasks is small or if a small percentage is blocked. +Being polling-based, in the general case it trades off efficiency for simplicity and +does not require any concurrency primitives such as `Arc`, etc. + +[simple-async-local-executor]: https://github.com/enlightware/simple-async-local-executor +[Enlightware]: https://enlightware.ch + ## Popular Workgroup Issues in Github From 77ec767f5654a2b48517504783e8d801ad5cef76 Mon Sep 17 00:00:00 2001 From: Joe Clay <27cupsofcoffee@gmail.com> Date: Mon, 3 May 2021 11:06:47 +0100 Subject: [PATCH 2/2] Update content/news/021/index.md --- content/news/021/index.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/content/news/021/index.md b/content/news/021/index.md index 16b2f49e3..bec5fe51e 100644 --- a/content/news/021/index.md +++ b/content/news/021/index.md @@ -327,11 +327,13 @@ assert_eq!(executor.step(), false); ``` [simple-async-local-executor] by [Enlightware] -is a single-threaded polling-based executor suitable for use in games, embedded systems or WASM. +is a single-threaded polling-based executor suitable for use in games, embedded +systems or WASM. -This executor can be useful when the number of tasks is small or if a small percentage is blocked. -Being polling-based, in the general case it trades off efficiency for simplicity and -does not require any concurrency primitives such as `Arc`, etc. +This executor can be useful when the number of tasks is small or +if a small percentage is blocked. Being polling-based, in the general +case it trades off efficiency for simplicity and does not require any +concurrency primitives such as `Arc`, etc. [simple-async-local-executor]: https://github.com/enlightware/simple-async-local-executor [Enlightware]: https://enlightware.ch