[fractal] Integrate Tokio runtime



commit 5ccfba44f597c2101c2ace0854fc6e09d3ca999e
Author: Alejandro Domínguez <adomu net-c com>
Date:   Tue Sep 1 13:51:03 2020 +0200

    Integrate Tokio runtime

 Cargo.lock                 | 1 +
 fractal-gtk/Cargo.toml     | 4 ++++
 fractal-gtk/src/app/mod.rs | 7 +++++++
 3 files changed, 12 insertions(+)
---
diff --git a/Cargo.lock b/Cargo.lock
index 09bbdaed..ba3110f6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -619,6 +619,7 @@ dependencies = [
  "serde",
  "serde_json",
  "sourceview4",
+ "tokio",
 ]
 
 [[package]]
diff --git a/fractal-gtk/Cargo.toml b/fractal-gtk/Cargo.toml
index 8ab99f2a..abc77656 100644
--- a/fractal-gtk/Cargo.toml
+++ b/fractal-gtk/Cargo.toml
@@ -76,3 +76,7 @@ features = ["v2_56"]
 git = "https://github.com/danigm/either.git";
 rev = "60c99bc0723491e2dfd42bbe9b485c5f9323e96b"
 features = ["serde_untagged"]
+
+[dependencies.tokio]
+version = "0.2.22"
+features = ["rt-threaded"]
diff --git a/fractal-gtk/src/app/mod.rs b/fractal-gtk/src/app/mod.rs
index 2e9824ff..8281ea38 100644
--- a/fractal-gtk/src/app/mod.rs
+++ b/fractal-gtk/src/app/mod.rs
@@ -2,10 +2,12 @@ use gettextrs::{bindtextdomain, setlocale, textdomain, LocaleCategory};
 use gio::prelude::*;
 use glib::clone;
 use gtk::prelude::*;
+use lazy_static::lazy_static;
 use libhandy::prelude::*;
 use std::cell::RefCell;
 use std::rc::Rc;
 use std::sync::{Arc, Mutex, Weak};
+use tokio::runtime::Runtime as TokioRuntime;
 
 use log::error;
 
@@ -22,6 +24,11 @@ mod windowstate;
 use windowstate::WindowState;
 
 static mut OP: Option<Weak<Mutex<AppOp>>> = None;
+
+lazy_static! {
+    pub static ref RUNTIME: TokioRuntime = TokioRuntime::new().unwrap();
+}
+
 #[macro_export]
 macro_rules! APPOP {
     ($fn: ident, ($($x:ident),*) ) => {{


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]