Skip to content

Allow start from outer runtime#1

Merged
tnull merged 1 commit into
mainfrom
2024-06-start-with-runtime
Jun 25, 2024
Merged

Allow start from outer runtime#1
tnull merged 1 commit into
mainfrom
2024-06-start-with-runtime

Conversation

@tnull
Copy link
Copy Markdown
Owner

@tnull tnull commented Jun 24, 2024

No description provided.

Comment thread src/lib.rs Outdated
/// a thread-safe manner.
///
/// FIXME: Document runtime
pub fn with_runtime(&self, runtime: Arc<tokio::runtime::Runtime>) -> Result<(), Error> {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe call this start_with_runtime?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread src/lib.rs
self.with_runtime(runtime)
}

/// Starts the necessary background tasks, such as handling events coming from user input,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super-nit for hack: Not sure if this doc is correct?
did we mean runtime coming from user input?

@tnull tnull force-pushed the 2024-06-start-with-runtime branch from 281cb67 to c64abf1 Compare June 25, 2024 13:41
@tnull
Copy link
Copy Markdown
Owner Author

tnull commented Jun 25, 2024

Force-pushed with the following changes:

> git diff-tree -U2  281cb67 c64abf1
diff --git a/src/lib.rs b/src/lib.rs
index 7facb39..41b87bd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -214,5 +214,5 @@ impl Node {
                let runtime =
                        Arc::new(tokio::runtime::Builder::new_multi_thread().enable_all().build().unwrap());
-               self.with_runtime(runtime)
+               self.start_with_runtime(runtime)
        }

@@ -224,5 +224,5 @@ impl Node {
        ///
        /// FIXME: Document runtime
-       pub fn with_runtime(&self, runtime: Arc<tokio::runtime::Runtime>) -> Result<(), Error> {
+       pub fn start_with_runtime(&self, runtime: Arc<tokio::runtime::Runtime>) -> Result<(), Error> {
                // Acquire a run lock and hold it until we're setup.
                let mut runtime_lock = self.runtime.write().unwrap();

Gonna land this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants