andygrove commented on pull request #8018:
URL: https://github.com/apache/arrow/pull/8018#issuecomment-677999442


   Thanks @jorgecarleitao I think both approaches look good too. Another 
potential solution is just to put the mutex lock in a smaller scope by putting 
it in curly braces e.g.
   
   ```rust
   let scalar_functions = {
       ctx_state
                   .expect("failed to lock mutex")
                       .lock()
                   .scalar_functions
                       .expect("failed to lock mutex")
                   .lock()
                       .scalar_functions
                   .expect("failed to lock mutex")
                       .lock()
                   .get(name)
                       .expect("Unable to lock mutex")
               {
                       .clone()
   };
   ```
   
   This way, the mutex gets released within this block instead of being kept 
open.
   
   @alamb Yes, the locking is yet more tech debt to be addressed. These things 
need to be mutable due to the dynamic/interactive nature of the context, but 
I'm sure there is a cleaner solution.


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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to