From c35484d7a1d9a3d1da136ca6b938649ae5e0c6dd Mon Sep 17 00:00:00 2001 From: Julian Hofer Date: Sun, 22 Oct 2023 18:00:22 +0200 Subject: [PATCH] book: Add main_event_loop_1 video --- book/src/main_event_loop.md | 16 +++++++++++++++- book/src/vid/main_event_loop_1.webm | Bin 0 -> 407721 bytes 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 book/src/vid/main_event_loop_1.webm diff --git a/book/src/main_event_loop.md b/book/src/main_event_loop.md index e8a108f29b33..63b7dda94150 100644 --- a/book/src/main_event_loop.md +++ b/book/src/main_event_loop.md @@ -26,6 +26,15 @@ We can't even move the window. The `sleep` call is an artificial example, but it is not unusual wanting to run a slightly longer operation in one go. + +
+ +
+ + ## How to Avoid Blocking the Main Loop In order to avoid blocking the main loop we can spawn a new task with [`gio::spawn_blocking`](https://gtk-rs.org/gtk-rs-core/stable/latest/docs/gio/fn.spawn_blocking.html) and let the operation run there. @@ -36,6 +45,10 @@ Filename: