DDtKey commented on PR #9318:
URL: 
https://github.com/apache/arrow-datafusion/pull/9318#issuecomment-1961267658

   Probably, such API is more intuitive:
   
   
   ```
   struct SpawnedTask<T>(JoinSet<T>);
   
   impl<T: 'static> SpawnedTask<T> {
      // it's constructor, without `self`
      pub fn spawn<F>(task: F) -> Self
       where
           F: Future<Output = T>,
           F: Send + 'static,
           T: Send,
       {
           let mut inner = JoinSet::new();
           inner.spawn(task);
           Ok(Self(inner))
       }   
       
       pub async fn join(&mut self) -> Result<T, JoinError> {
           self.inner.join_next().await.expect("instance always have 1 task")
       }
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to