aboutsummaryrefslogtreecommitdiffstats
path: root/components/net/async_runtime.rs
diff options
context:
space:
mode:
authortannal <149947508+tannal@users.noreply.github.com>2024-03-21 14:13:03 +0800
committerGitHub <noreply@github.com>2024-03-21 06:13:03 +0000
commit5c0199b5687a5c0c1b2fe82235ca609c7d9ea614 (patch)
tree87b9ede2b821c0c651d5b803358ae2c177330849 /components/net/async_runtime.rs
parent2789e9887666a05695778bd9d822616985b40dbc (diff)
downloadservo-5c0199b5687a5c0c1b2fe82235ca609c7d9ea614.tar.gz
servo-5c0199b5687a5c0c1b2fe82235ca609c7d9ea614.zip
Net: fold websocket and http tokio runtime into one (#31771)
* net: use the same tokio runtime in websocket loader #31648 * readability * license
Diffstat (limited to 'components/net/async_runtime.rs')
-rw-r--r--components/net/async_runtime.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/components/net/async_runtime.rs b/components/net/async_runtime.rs
new file mode 100644
index 00000000000..c06d570d9ae
--- /dev/null
+++ b/components/net/async_runtime.rs
@@ -0,0 +1,12 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+
+use std::sync::Mutex;
+
+use lazy_static::lazy_static;
+use tokio::runtime::Runtime;
+
+lazy_static! {
+ pub static ref HANDLE: Mutex<Option<Runtime>> = Mutex::new(Some(Runtime::new().unwrap()));
+}