datbth commented on issue #48454:
URL: https://github.com/apache/arrow/issues/48454#issuecomment-3640844064

   Sorry, I just tested again and see that using Threads works as expected:
   ```ruby
   threads = [
     Thread.new do
       client = new_client
       reader = client.do_get
       reader.read_all
       1
     ensure
       client&.close
     end,
     Thread.new do
       client = new_client
       reader = client.do_get
       reader.read_all
       2
     ensure
       client&.close
     end,
   ]
   threads.each(&:join)
   ```
   
   <img width="2497" height="1783" alt="Image" 
src="https://github.com/user-attachments/assets/dcce3a15-ced7-45e5-a3d5-fd5412f75ee1";
 />
   
   
   What I tried earlier: using [`async` gem](https://github.com/socketry/async) 
(with ruby 3.2.6):
   ```ruby
   require 'async'
   
   Async do
     [
       Async do
         client = new_client
         reader = client.do_get
         reader.read_all
         1
       ensure
         client&.close
       end,
       Async do
         client = new_client
         reader = client.do_get
         reader.read_all
         2
       ensure
         client&.close
       end,
     ].map(&:wait)
   end.wait
   ```
   But I haven't had much experience with it either, so I'm now not sure if 
this is the normal/expected behavior when using `async` or not.  
   
   Can close this issue if you're not interested.


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