NobodyXu commented on PR #2192:
URL: 
https://github.com/apache/incubator-opendal/pull/2192#issuecomment-1537048762

   > What I mean is not `Send + Sync`.
   > 
   > ```
   > stdio_cloned.set(Ok((stdin, stdout))).unwrap();
   > drop(stdio_cloned);
   > 
   > if let Some(once_cell) = Arc::get_mut(&mut stdio)
   > ```
   > 
   > Because these two strings of code may be executed in different threads, it 
may happen that `Arc strong_count` decrements behavior earlier than setting 
stdio_cloned. We need to set extra memory order to avoid it.
   
   That can't happen.
   
   The future is executed in the same thread as Arc::get_mut, since it doesn't 
tokio::spawn anything, rather it just Box the future and poll it in the current 
thread.
   
   Also, the piece of code cannot interleave.
   In Rust, Future can only yield at .await point, but there's no .await 
between setting once-cell and dropping the arc.


-- 
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