pitrou commented on code in PR #37822:
URL: https://github.com/apache/arrow/pull/37822#discussion_r1344268464


##########
python/pyarrow/io.pxi:
##########
@@ -677,16 +676,19 @@ cdef class NativeFile(_Weakrefable):
 
         self.seek(0)
 
-        writer_thread = threading.Thread(target=bg_write)
+        if is_threading_enabled():
+            writer_thread = threading.Thread(target=bg_write)
+        else:
+            writer_thread = None
 
         # This isn't ideal -- PyBytes_FromStringAndSize copies the data from
         # the passed buffer, so it's hard for us to avoid doubling the memory
         buf = <uint8_t*> malloc(buffer_size)
         if buf == NULL:
             raise MemoryError("Failed to allocate {0} bytes"
                               .format(buffer_size))
-
-        writer_thread.start()
+        if writer_thread:

Review Comment:
   Instead of sprinkling `if writer_thread` conditionals everywhere, I think 
this would be clearer if there were two separate implementations.



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