Skip to content

Commit

Permalink
feat(jstzd): update signature
Browse files Browse the repository at this point in the history
  • Loading branch information
huancheng-trili committed Sep 12, 2024
1 parent ad6cd04 commit 6e65a3b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions crates/jstzd/src/task/joinhandle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ impl JoinHandle {
}
}

/// This function will block until the task has exited, returning a success or an error
async fn wait(&mut self) -> anyhow::Result<()> {
pub async fn wait(&mut self) -> anyhow::Result<()> {
loop {
if let Ok(mut result_container) = self.execution_result.try_lock() {
let finished = match self.handle.as_ref() {
Expand All @@ -133,7 +132,7 @@ impl JoinHandle {

/// This function will signal the running task with the specified signal
/// This is a non-blocking operation
fn signal(&self, signal: Signal) -> anyhow::Result<()> {
pub fn signal(&self, signal: Signal) -> anyhow::Result<()> {
if let Some(tx) = &self.signal_tx {
let copy = tx.clone();
tokio::spawn(async move {
Expand All @@ -143,7 +142,7 @@ impl JoinHandle {
return anyhow::Ok(());
}

async fn abort(&mut self) {
pub async fn abort(&mut self) {
if let Some(handle) = self.handle.as_ref() {
handle.abort();
}
Expand Down

0 comments on commit 6e65a3b

Please sign in to comment.