Introduced dylib extension format, cleared up shutdown sequence
This commit is contained in:
@@ -10,7 +10,7 @@ use crate::ext_port::ExtPort;
|
||||
/// value returned by [crate::system_ctor::SystemCtor::inst] to initiate
|
||||
/// shutdown.
|
||||
#[cfg(feature = "tokio")]
|
||||
pub async fn tokio_main(builder: ExtensionBuilder) -> ! {
|
||||
pub async fn tokio_entrypoint(builder: ExtensionBuilder) {
|
||||
use tokio::io::{stderr, stdin, stdout};
|
||||
use tokio::task::{LocalSet, spawn_local};
|
||||
use tokio_util::compat::{TokioAsyncReadCompatExt, TokioAsyncWriteCompatExt};
|
||||
@@ -27,5 +27,12 @@ pub async fn tokio_main(builder: ExtensionBuilder) -> ! {
|
||||
});
|
||||
});
|
||||
local_set.await;
|
||||
std::process::exit(0)
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! tokio_main {
|
||||
($builder:expr) => {
|
||||
#[tokio::main]
|
||||
pub async fn main() { $crate::tokio::tokio_entrypoint($builder).await }
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user